src/Orleans.Core.Abstractions/IDs/ClientGrainId.cs
/// <summary>
/// Converts the provided <see cref="GrainId"/> to a <see cref="ClientGrainId"/>. A return value indicates whether the operation succeeded.
/// </summary>
Converts the provided  to a . A return value indicates whether the operation succeeded.
Converts the provided to a . A return value indicates whether the operation succeeded .
public static bool TryParse(GrainId grainId, out ClientGrainId clientId)
        {
            if (!grainId.Type.IsClient())
            {
                clientId = default;
                return false;
            }
            var key = grainId.Key.AsSpan();
            if (key.IndexOf((byte)ObserverGrainId.SegmentSeparator) is int index && index >= 0)
            {
                key = key.Slice(0, index);
                grainId = new GrainId(grainId.Type, new IdSpan(key.ToArray()));
            }
            clientId = new ClientGrainId(grainId);
            return true;
        }
public static bool TryParse ( GrainId grainId , out ClientGrainId clientId ) { if ( ! grainId . Type . IsClient ( ) ) { clientId = default ; return false ; } var key = grainId . Key . AsSpan ( ) ; if ( key . IndexOf ( ( byte ) ObserverGrainId . SegmentSeparator ) is int index && index >= 0 ) { key = key . Slice ( 0 , index ) ; grainId = new GrainId ( grainId . Type , new IdSpan ( key . ToArray ( ) ) ) ; } clientId = new ClientGrainId ( grainId ) ; return true ; }
Converts the provided  to a .
Converts the provided to a .
// Strip the observer id, if present.
grainId
GrainId
ClientGrainId
out