System.Reflection.Emit.FieldBuilder.SetConstant C# (CSharp) Method

SetConstant() public method

public SetConstant ( object defaultValue ) : void
defaultValue object
return void
        public void SetConstant(object defaultValue) { }
        public void SetCustomAttribute(System.Reflection.ConstructorInfo con, byte[] binaryAttribute) { }

Usage Example

コード例 #1
0
        /// <summary>Defines the named static field in an enumeration type with the specified constant value.</summary>
        /// <returns>The defined field.</returns>
        /// <param name="literalName">The name of the static field. </param>
        /// <param name="literalValue">The constant value of the literal. </param>
        public FieldBuilder DefineLiteral(string literalName, object literalValue)
        {
            FieldBuilder fieldBuilder = this._tb.DefineField(literalName, this, FieldAttributes.FamANDAssem | FieldAttributes.Family | FieldAttributes.Static | FieldAttributes.Literal);

            fieldBuilder.SetConstant(literalValue);
            return(fieldBuilder);
        }
All Usage Examples Of System.Reflection.Emit.FieldBuilder::SetConstant