ICloneable is not available in Silverlight 4(I don't know about 1/2/3 or upcoming version) . It is removed from Silverlight 4's public APIs.
I have these classes :
public class LayerDto
{
public MetaItemDtoList MetaItems;
}
public class MetaItemDtoList : System.Collections.ObjectModel.ObservableCollection
{
}
I want to create clone of IEnumerable<LayerDto>
.
I am trying to do this. but not getting metaItems
public static IEnumerable Clone(IEnumerable<LayerDto> source)
{
IEnumerable<LayerDto> layers;
DataContractSerializer serializer = new DataContractSerializer(typeof(IEnumerable<LayerDto>));
开发者_C百科 using (MemoryStream ms = new MemoryStream())
{
serializer.WriteObject(ms, source);
ms.Seek(0, SeekOrigin.Begin);
//return (IEnumerable<LayerDto>)serializer.ReadObject(ms);
layers = (IEnumerable<LayerDto>)serializer.ReadObject(ms);
return layers;
}
}
精彩评论