Core/CafeLib.Core/Support/ObjectId.cs
/// <summary>
/// Tries to parse a string and create a new ObjectId.
/// </summary>
/// <param name="s">The string value.</param>
/// <param name="objectId">The new ObjectId.</param>
/// <returns>True if the string was parsed successfully.</returns>
Tries to parse a string and create a new ObjectId.
Tries to parse a string and create a new ObjectId .
public static bool TryParse(string s, out ObjectId objectId)
        {
            if (s != null && s.Length == 24)
            {
                if (TryParseHexString(s, out var bytes))
                {
                    objectId = new ObjectId(bytes);
                    return true;
                }
            }
            objectId = default;
            return false;
        }
public static bool TryParse ( string s , out ObjectId objectId ) { if ( s != null && s . Length == 24 ) { if ( TryParseHexString ( s , out var bytes ) ) { objectId = new ObjectId ( bytes ) ; return true ; } } objectId = default ; return false ; }
Tries to parse a string and create a new ObjectId.
Tries to parse a string and create a new ObjectId .
// don't throw ArgumentNullException if s is null
True if the string was parsed successfully.
True if the string was parsed successfully .
s
string
The string value.
The string value .
ObjectId
out
objectId
The new ObjectId.
The new ObjectId .