sdk/dotnet/src/Microsoft.Datasync.Client/Serialization/ServiceSerializer.cs
/// <summary>
/// Tries to get the value of the ID property from an instance.
/// </summary>
/// <param name="instance">The subject instance.</param>
/// <param name="ignoreCase">If <c>true</c>, find any variant spelling of the ID property.</param>
/// <param name="id">On return, the value of the ID property or <c>null</c>.</param>
/// <returns><c>true</c> if the property has an ID property, <c>false</c> otherwise.</returns>
Tries to get the value of the ID property from an instance.
Tries to get the value of the ID property from an instance .
public static bool TryGetId(JObject instance, bool ignoreCase, out string id)
        {
            StringComparison comparator = ignoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal;
            bool hasId = instance.TryGetValue(SystemProperties.JsonIdProperty, comparator, out JToken idToken);
            id = (hasId && idToken is JValue idValue && idValue.Type == JTokenType.String) ? idValue.Value<string>() : null;
            return hasId && id != null;
        }
public static bool TryGetId ( JObject instance , bool ignoreCase , out string id ) { StringComparison comparator = ignoreCase ? StringComparison . OrdinalIgnoreCase : StringComparison . Ordinal ; bool hasId = instance . TryGetValue ( SystemProperties . JsonIdProperty , comparator , out JToken idToken ) ; id = ( hasId && idToken is JValue idValue && idValue . Type == JTokenType . String ) ? idValue . Value < string > ( ) : null ; return hasId && id != null ; }
Tries to get the value of the ID property from an instance.
Tries to get the value of the ID property from an instance .
None
instance
JObject
The subject instance.
The subject instance .
ignoreCase
bool
None
string
out
id
On return, the value of the ID property or null
On return the value of the ID property or null