Skip to content
Browse files

Fixed incorrect presentation of arrays in cache key.

  • Loading branch information...
1 parent bfa1acb commit 62b3389056760e5ea9ba4e213af11b96ef808221 @Mikhail-Fiadosenka committed Apr 24, 2012
Showing with 17 additions and 1 deletion.
  1. +17 −1 src/SoundInTheory.DynamicImage/DirtyTrackingObject.cs
View
18 src/SoundInTheory.DynamicImage/DirtyTrackingObject.cs
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Text;
+using System.Collections;
namespace SoundInTheory.DynamicImage
{
@@ -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();

0 comments on commit 62b3389

Please sign in to comment.
Something went wrong with that request. Please try again.