FieldInfo.IsLiteral 属性

定义

获取一个值,通过该值指示该值是否在编译时写入并且不能更改。Gets a value indicating whether the value is written at compile time and cannot be changed.

public:
 property bool IsLiteral { bool get(); };
public bool IsLiteral { get; }
member this.IsLiteral : bool
Public ReadOnly Property IsLiteral As Boolean

属性值

如果字段设置了 true 属性,则为 Literal;否则为 falsetrue if the field has the Literal attribute set; otherwise, false.

实现

注解

设置 FieldAttributes.Literal 特性时,将设置 IsLiteral 属性。The IsLiteral property is set when the FieldAttributes.Literal attribute is set. 如果设置此属性,则不能更改该字段,并且该字段是常量。If this attribute is set, the field cannot be changed and is constant.

适用于

另请参阅