using
System;
using
System.Collections.Generic;
using
System.Collections ;
using
System.Linq;
using
System.Text;
using
System.IO;
using
System.Runtime.Serialization;
using
System.Runtime.Serialization.Formatters.Binary;
namespace
LINQ
{
[Serializable]
public
class
tt
{
private
string
name =
""
;
public
string
Name
{
get
{
return
name; }
set
{ name = value; }
}
private
string
sex =
""
;
public
string
Sex
{
get
{
return
sex; }
set
{ sex = value; }
}
}
class
LINQTest
{
public
static
T Clone<T>(T RealObject)
{
using
(Stream objectStream =
new
MemoryStream())
{
IFormatter formatter =
new
BinaryFormatter();
formatter.Serialize(objectStream, RealObject);
objectStream.Seek(0, SeekOrigin.Begin);
return
(T)formatter.Deserialize(objectStream);
}
}
public
static
void
Main()
{
List<tt> lsttt =
new
List<tt>();
tt tt1 =
new
tt();
tt1.Name =
"a1"
;
tt1.Sex =
"20"
;
lsttt.Add(tt1);
List<tt> l333 =
new
List<tt>();
l333.Add(Clone<tt>(lsttt[0]));
l333[0].Name =
"333333333"
;
}
}
}