src/Orleans.Core.Abstractions/Core/GrainExtensions.cs
/// <summary>
/// Returns a typed reference to the provided grain.
/// </summary>
/// <typeparam name="TGrainInterface">The type of the grain interface.</typeparam>
/// <param name="grain">The grain to convert.</param>
/// <remarks>
/// If the provided value is a grain instance, this will create a reference which implements the provided interface.
/// If the provided value is already grain reference, this will create a new reference which implements the provided interface.
/// </remarks>
/// <returns>A strongly typed reference to the provided grain which implements <typeparamref name="TGrainInterface"/>.</returns>
Returns a typed reference to the provided grain.
Returns a typed reference to the provided grain .
public static TGrainInterface AsReference<TGrainInterface>(this IAddressable grain)
        {
            if (grain is null)
            {
                ThrowGrainNull();
            }
            var grainReference = grain.AsReference();
            return (TGrainInterface)grainReference.Runtime.Cast(grain, typeof(TGrainInterface));
        }
public static TGrainInterface AsReference < TGrainInterface > ( this IAddressable grain ) { if ( grain is null ) { ThrowGrainNull ( ) ; } var grainReference = grain . AsReference ( ) ; return ( TGrainInterface ) grainReference . Runtime . Cast ( grain , typeof ( TGrainInterface ) ) ; }
Returns a typed reference to the provided grain.
Returns a typed reference to the provided grain .
A strongly typed reference to the provided grain which implements .
A strongly typed reference to the provided grain which implements .
IAddressable
this
grain
The grain to convert.
The grain to convert .
typeparam
The type of the grain interface.
The type of the grain interface .
remarks
If the provided value is a grain instance, this will create a reference which implements the provided interface.
If the provided value is already grain reference, this will create a new reference which implements the provided interface.
If the provided value is a grain instance this will create a reference which implements the provided interface . If the provided value is already grain reference this will create a new reference which implements the provided interface .