2
我有在下面的toJSON()方法返回一個字符串,它僅僅是一個問題「{}」JsonConvert系列化回報「{}」
public class GenericRequest
{
public enum SupportedCommands
{
REGISTER, LOGIN, LOGOUT
}
private SupportedCommands command;
private String authentication;
private String password;
private String email;
public GenericRequest(SupportedCommands comm, string aut, string pass, string mail)
{
command = comm;
authentication = aut;
password = pass;
email = mail;
}
virtual public string ToJson()
{
return JsonConvert.SerializeObject(this);
}
}
有任何想法爲什麼系列化命令沒有按序列化班級的成員?
非常感謝你! –