You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
varpa=new System.Net.NetworkInformation.PhysicalAddress(newbyte[]{1,2,3,4,5,6});varstrValue= pa.ToString();varjsonValue= JsonConvert.SerializeObject(pa, SerializerSettings);
Console.WriteLine($"String value is {strValue}");
Console.WriteLine($"JSON value is {jsonValue}");/*String value is 010203040506JSON value is {}*/
varipa=new System.Net.IPAddress(newbyte[]{1,1,1,1});varstrValue= ipa.ToString();varjsonValue= JsonConvert.SerializeObject(ipa, SerializerSettings);
Console.WriteLine($"String value is {strValue}");
Console.WriteLine($"JSON value is {jsonValue}");/*String value is 1.1.1.1JSON value is {"AddressFamily":"InterNetwork","IsIPv6Multicast":false,"IsIPv6LinkLocal":false,"IsIPv6SiteLocal":false,"IsIPv6Teredo":false,"IsIPv6UniqueLocal":false,"IsIPv4MappedToIPv6":false,"Address":16843009}*/
P.S. For enum you can use the StringEnumConverter converter in the serialization options
Since we use Newtonsoft.JSON with the default settings to serialize test or step parameters, some values are serialized in a less-than-optimal way:
Those are obvious cases when ToString would be preferrable.
The text was updated successfully, but these errors were encountered: