Warum dieser Code nicht ausgeführt wird, möchte ich überprüfen, ob JSON Ganzzahl für Schlüssel PurchasedValue
oder nicht enthält?():Überprüfen, ob JValue null ist
public PropertyInfo(Newtonsoft.Json.Linq.JToken jToken)
{
this.jToken = jToken;
int PurchasedValue = (int)(jToken["PurchasedValue"].Value ?? 0);
}
der Fehler ist:
Error CS0019: Operator `??' cannot be applied to operands of type `method group' and `int' (CS0019)
Es ist von Newtonsoft JSON.NET – AVEbrahimi