public static T OutErr(int returnCode=1, the string returnMsg="")
{
JObject j=new JObject ();
JsonDo. OutReturnHead (j, returnCode returnMsg);
String a=typeof (T). The ToString ();
If (a=="System. The String")
Return (T) (object) j.t. oString ();
The else
Return (T) (object) j;
}
Can I think so, to T to specify a default type, such as:
public static T OutErr(int returnCode=1, the string returnMsg="")
{
JObject j=new JObject ();
JsonDo. OutReturnHead (j, returnCode returnMsg);
String a=typeof (T). The ToString ();
If (a=="System. The String")
Return (T) (object) j.t. oString ();
The else
Return (T) (object) j;
}
CodePudding user response:
Write a method package onceCodePudding user response:
There should be no direct support of grammar,CodePudding user response:
Direct overloading just a matter of
Public static string OutErr (int returnCode=1, the string returnMsg="")
{
Return the default;
}
CodePudding user response:
Don't know JsonDo. OutReturnHead (j, returnCode returnMsg); This is whatTry this write
Public static object OutErr (int returnCode=1, the string returnMsg="")
{
JObject j=new JObject ();
JsonDo. OutReturnHead (j, returnCode returnMsg);
If (j.G etType ()==typeof (string))
Return j.t. oString ();
The else
Return j;
}
CodePudding user response:
The