Skip to content

Commit

Permalink
Fixed incorrect presentation of arrays in cache key.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikhail-fedosenko committed Apr 24, 2012
1 parent bfa1acb commit 62b3389
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/SoundInTheory.DynamicImage/DirtyTrackingObject.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace SoundInTheory.DynamicImage
{
Expand Down Expand Up @@ -50,9 +51,24 @@ string IDirtyTrackingObject.GetDirtyProperties()
foreach (var kvp in _propertyStore)
{
if (kvp.Value is IDirtyTrackingObject)
{
sb.AppendFormat("{0}: {1};", kvp.Key, ((IDirtyTrackingObject)kvp.Value).GetDirtyProperties());
}
else
sb.AppendFormat("{0}: {1};", kvp.Key, kvp.Value);
{
// Write each element of an array individially
if (kvp.Value is IEnumerable && !(kvp.Value is string))
{
sb.AppendFormat("{0}: [", kvp.Key);
foreach (var element in (IEnumerable)kvp.Value)
sb.AppendFormat("{0},", element);
sb.Append("]");
}
else
{
sb.AppendFormat("{0}: {1};", kvp.Key, kvp.Value);
}
}
}
sb.Append("}");
return sb.ToString();
Expand Down

0 comments on commit 62b3389

Please sign in to comment.