SCJMapper-V2/CloneableItems.cs
bm98 ffe5005c2b PreRelease Build 62 saved on git
updates of dev tuning for strafe #48
improvement of control and selection #49
fix exception for multiple actionmaps #51
improvement for collapsing the treeview
added Options dialog for all items in one window
some minor fixes/refacturings on the way
2017-04-15 00:33:21 +02:00

34 lines
867 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SCJMapper_V2
{
public class CloneableDictionary<TKey, TValue> : Dictionary<TKey, TValue> where TValue : ICloneable
{
public virtual object Clone( )
{
CloneableDictionary<TKey, TValue> clone = new CloneableDictionary<TKey, TValue>();
foreach ( KeyValuePair<TKey, TValue> kvp in this ) {
clone.Add( kvp.Key, ( TValue )kvp.Value.Clone( ) );
}
return clone;
}
}
public class CloneableList<TValue> : List<TValue> where TValue : ICloneable
{
public virtual CloneableList<TValue> Clone( )
{
CloneableList<TValue> clone = new CloneableList<TValue>();
foreach ( TValue kvp in this ) {
clone.Add( ( TValue )kvp.Clone( ) );
}
return clone;
}
}
}