/// <summary>
/// 选答题
/// </summary>
public class SelectTest
{
private string other;
public string 你老婆多大
{
get
{
return this.other;
}
set
{
this.other = value;
}
}
}
/// <summary>
/// 面试题
/// </summary>
public interface Itest
{
Itest Clone();
string 知道设计模式吗
{
get;
set;
}
string 设计模式有几种
{
get;
set;
}
string 你知道那些
{
get;
set;
}
SelectTest 附加题
{
get;
set;
}
Test Test
{
get;
set;
}
Test Test1
{
get;
set;
}
}
/// <summary>
/// 继承Itest接口
/// </summary>
public class Test : Itest
{
private string one;
private string two;
private string three;
private SelectTest other=new SelectTest();
public string 知道设计模式吗
{
get
{
return this.one;
}
set
{
this.one = value;
}
}
public string 设计模式有几种
{
get
{
return this.two;
}
set
{
this.two = value;
}
}
public string 你知道那些
{
get
{
return this.three;
}
set
{
this.three = value;
}
}
public SelectTest 附加题
{
get
{
return this.other;
}
set
{
this.other = value;
}
}
#region IColorDemo 成员
public Itest Clone()
{
//克隆当前类
return (Itest)this.MemberwiseClone();
}
#endregion
}
static void Main()
{
//印刷试卷
Itest test = new Test();
//复制样本试卷
Itest test1 = test.Clone();
//考生1
test.设计模式有几种 = "23";
test.附加题.你老婆多大 = "18";
//考生2
test1.设计模式有几种 = "24";
test1.附加题.你老婆多大 = "20";
//显示考生答卷内容
Console.WriteLine("test设计模式有几种:" + test.设计模式有几种); //23
Console.WriteLine("test附加题.你老婆多大:" + test.附加题.你老婆多大); //20
Console.WriteLine("test1设计模式有几种:" + test1.设计模式有几种); //24
Console.WriteLine("test1附加题.你老婆多大:" + test1.附加题.你老婆多大); //20
Console.ReadKey();
}
public Itest Clone()
{
//克隆当前类
Itest itst= (Itest)this.MemberwiseClone();
SelectTest st = new SelectTest();
st.你老婆多大 = this.other.你老婆多大;
itst.附加题 = st;
return itst;
}
/// <summary>
/// 选答题
/// </summary>
[Serializable]
public class SelectTest
{
private string other;
public string 你老婆多大
{
get
{
return this.other;
}
set
{
this.other = value;
}
}
}
/// <summary>
/// 面试题
/// </summary>
public interface Itest
{
Itest Clone();
string 知道设计模式吗
{
get;
set;
}
string 设计模式有几种
{
get;
set;
}
string 你知道那些
{
get;
set;
}
SelectTest 附加题
{
get;
set;
}
}
/// <summary>
/// 继承Itest接口
/// </summary>
public class Test : Itest
{
private string one;
private string two;
private string three;
private SelectTest other=new SelectTest();
public string 知道设计模式吗
{
get
{
return this.one;
}
set
{
this.one = value;
}
}
public string 设计模式有几种
{
get
{
return this.two;
}
set
{
this.two = value;
}
}
public string 你知道那些
{
get
{
return this.three;
}
set
{
this.three = value;
}
}
public SelectTest 附加题
{
get
{
return this.other;
}
set
{
this.other = value;
}
}
public Itest Clone()
{
SerializableHelper SerializableHelper = new 原型模式.SerializableHelper();
string target = SerializableHelper.Serializable(this);
return SerializableHelper.Derializable<Itest>(target);
}
}
public class SerializableHelper
{
public string Serializable(object target)
{
using (MemoryStream stream = new MemoryStream())
{
new BinaryFormatter().Serialize(stream, target);
return Convert.ToBase64String(stream.ToArray());
}
}
public object Derializable(string target)
{
byte[] targetArray = Convert.FromBase64String(target);
using (MemoryStream stream = new MemoryStream(targetArray))
{
return new BinaryFormatter().Deserialize(stream);
}
}
public T Derializable<T>(string target)
{
return (T)Derializable(target);
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有