src/Orleans.Core/Lifecycle/LifecycleSubject.cs
/// <summary>
/// Gets the collection of all stage numbers and their corresponding names.
/// </summary>
/// <seealso cref="ServiceLifecycleStage"/>
/// <param name="type">The lifecycle stage class.</param>
/// <returns>The collection of all stage numbers and their corresponding names.</returns>
Gets the collection of all stage numbers and their corresponding names.
Gets the collection of all stage numbers and their corresponding names .
protected static ImmutableDictionary<int, string> GetStageNames(Type type)
        {
            try
            {
                var result = ImmutableDictionary.CreateBuilder<int, string>();
                var fields = type.GetFields(
                    System.Reflection.BindingFlags.Static
                    | System.Reflection.BindingFlags.Public
                    | System.Reflection.BindingFlags.NonPublic);
                foreach (var field in fields)
                {
                    if (typeof(int).IsAssignableFrom(field.FieldType))
                    {
                        try
                        {
                            var value = (int)field.GetValue(null);
                            result[value] = $"{field.Name} ({value})";
                        }
                        catch
                        {
                        }
                    }
                }
                return result.ToImmutable();
            }
            catch
            {
                return ImmutableDictionary<int, string>.Empty;
            }
        }
protected static ImmutableDictionary < int , string > GetStageNames ( Type type ) { try { var result = ImmutableDictionary . CreateBuilder < int , string > ( ) ; var fields = type . GetFields ( System . Reflection . BindingFlags . Static | System . Reflection . BindingFlags . Public | System . Reflection . BindingFlags . NonPublic ) ; foreach ( var field in fields ) { if ( typeof ( int ) . IsAssignableFrom ( field . FieldType ) ) { try { var value = ( int ) field . GetValue ( null ) ; result [ value ] = $" { field . Name }  ( { value } ) " ; } catch { } } } return result . ToImmutable ( ) ; } catch { return ImmutableDictionary < int , string > . Empty ; } }
Gets the collection of all stage numbers and their corresponding names.
Gets the collection of all stage numbers and their corresponding names .
// Ignore.
The collection of all stage numbers and their corresponding names.
The collection of all stage numbers and their corresponding names .
type
Type
The lifecycle stage class.
The lifecycle stage class .
seealso
None