为什么只能这样生成序列化对象
Type t = target.GetType();
string jsonString = string.Empty;
DataContractJsonSerializer ds = new DataContractJsonSerializer(t);
不能
string jsonString = string.Empty;
DataContractJsonSerializer ds = new DataContractJsonSerializer(typeof(target));
这样呢第二个编译不通过
求解释在线等待大牛速结~3Q~
Type t = target.GetType();
string jsonString = string.Empty;
DataContractJsonSerializer ds = new DataContractJsonSerializer(t);
不能
string jsonString = string.Empty;
DataContractJsonSerializer ds = new DataContractJsonSerializer(typeof(target));
这样呢第二个编译不通过
求解释在线等待大牛速结~3Q~
Console.WriteLine(i.GetType());
Console.WriteLine(typeof(int));typeof的参数应该是类型。而不是实例