简体   繁体   中英

change JTokenType property of JToken object

I want to write a function (c#) that get JToken as parameter and change his Type from JTokenType.Date to JTokenType.String (it's a readonly property so i cant do it)

something like:

if(jTokenObject.Type == JTokenType.Date)
{
\\code here...
}

ok i've found a way by myself xd

private static string JTokenToString(JToken jtoken)
{
     var JTokenReader = new JTokenReader(jtoken);

     return JTokenReader.ReadAsString();
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM