public abstract class CommonReq
{
private String TransNo { get; set; }
public String SubmitData { get; set; }
private String Sign { get; set; }
public String Encoding { get; set; }
public CommonReq()
{
this.TransNo = Guid.NewGuid().ToString();
}
}
class Request:CommonReq
{
}
class Program
{
static void Main(string[] args)
{
Request req = new Request
{
SubmitData="A=1",
Encoding="utf-8"
};
var req2 = Activator.CreateInstance(typeof(Request)) as CommonReq;
}
}
仍然可行