Class RoslynFieldInfo
Namespace: Neon.Roslyn
Assembly: Neon.Roslyn.dll
Syntax
public class RoslynFieldInfo : FieldInfo
Constructors
RoslynFieldInfo(IFieldSymbol, MetadataLoadContext)
Declaration
public RoslynFieldInfo(IFieldSymbol parameter, MetadataLoadContext metadataLoadContext)
Parameters
Type | Name | Description |
---|---|---|
IFieldSymbol | parameter | |
MetadataLoadContext | metadataLoadContext |
Properties
Attributes
Gets the attributes associated with this field.
Declaration
public override FieldAttributes Attributes { get; }
Property Value
Type | Description |
---|---|
FieldAttributes | The |
Overrides
DeclaringType
Gets the class that declares this member.
Declaration
public override Type DeclaringType { get; }
Property Value
Type | Description |
---|---|
Type | The |
Overrides
FieldHandle
Gets a RuntimeFieldHandle
, which is a handle to the internal metadata representation of a field.
Declaration
public override RuntimeFieldHandle FieldHandle { get; }
Property Value
Type | Description |
---|---|
RuntimeFieldHandle | A handle to the internal metadata representation of a field. |
Overrides
FieldSymbol
Declaration
public IFieldSymbol FieldSymbol { get; }
Property Value
Type | Description |
---|---|
IFieldSymbol |
FieldType
Gets the type of this field object.
Declaration
public override Type FieldType { get; }
Property Value
Type | Description |
---|---|
Type | The type of this field object. |
Overrides
Name
Gets the name of the current member.
Declaration
public override string Name { get; }
Property Value
Type | Description |
---|---|
string | A string containing the name of this member. |
Overrides
ReflectedType
Gets the class object that was used to obtain this instance of MemberInfo
.
Declaration
public override Type ReflectedType { get; }
Property Value
Type | Description |
---|---|
Type | The |
Overrides
Methods
GetCustomAttributes(bool)
When overridden in a derived class, returns an array of all custom attributes applied to this member.
Declaration
public override object[] GetCustomAttributes(bool inherit)
Parameters
Type | Name | Description |
---|---|---|
bool | inherit | true to search this member's inheritance chain to find the attributes; otherwise, false. This parameter is ignored for properties and events. |
Returns
Type | Description |
---|---|
object[] | An array that contains all the custom attributes applied to this member, or an array with zero elements if no attributes are defined. |
Overrides
Exceptions
Type | Condition |
---|---|
InvalidOperationException | This member belongs to a type that is loaded into the reflection-only context. See How to: Load Assemblies into the Reflection-Only Context. |
TypeLoadException | A custom attribute type could not be loaded. |
GetCustomAttributes(Type, bool)
When overridden in a derived class, returns an array of custom attributes applied to this member and identified by Type.
Declaration
public override object[] GetCustomAttributes(Type attributeType, bool inherit)
Parameters
Type | Name | Description |
---|---|---|
Type | attributeType | The type of attribute to search for. Only attributes that are assignable to this type are returned. |
bool | inherit | true to search this member's inheritance chain to find the attributes; otherwise, false. This parameter is ignored for properties and events. |
Returns
Type | Description |
---|---|
object[] | An array of custom attributes applied to this member, or an array with zero elements if no attributes assignable to |
Overrides
Exceptions
Type | Condition |
---|---|
TypeLoadException | A custom attribute type cannot be loaded. |
ArgumentNullException | If |
InvalidOperationException | This member belongs to a type that is loaded into the reflection-only context. See How to: Load Assemblies into the Reflection-Only Context. |
GetCustomAttributesData()
Returns a list of CustomAttributeData objects representing data about the attributes that have been applied to the target member.
Declaration
public override IList<CustomAttributeData> GetCustomAttributesData()
Returns
Type | Description |
---|---|
IList<CustomAttributeData> | A generic list of CustomAttributeData objects representing data about the attributes that have been applied to the target member. |
Overrides
GetValue(object)
When overridden in a derived class, returns the value of a field supported by a given object.
Declaration
public override object GetValue(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The object whose field value will be returned. |
Returns
Type | Description |
---|---|
object | An object containing the value of the field reflected by this instance. |
Overrides
Exceptions
Type | Condition |
---|---|
TargetException | The field is non-static and Note: In .NET for Windows Store apps or the Portable Class Library, catch Exception instead. |
NotSupportedException | A field is marked literal, but the field does not have one of the accepted literal types. |
FieldAccessException | The caller does not have permission to access this field. Note: In .NET for Windows Store apps or the Portable Class Library, catch the base class exception, MemberAccessException, instead. |
ArgumentException | The method is neither declared nor inherited by the class of |
IsDefined(Type, bool)
When overridden in a derived class, indicates whether one or more attributes of the specified type or of its derived types is applied to this member.
Declaration
public override bool IsDefined(Type attributeType, bool inherit)
Parameters
Type | Name | Description |
---|---|---|
Type | attributeType | The type of custom attribute to search for. The search includes derived types. |
bool | inherit | true to search this member's inheritance chain to find the attributes; otherwise, false. This parameter is ignored for properties and events. |
Returns
Type | Description |
---|---|
bool | true if one or more instances of |
Overrides
SetValue(object, object, BindingFlags, Binder, CultureInfo)
When overridden in a derived class, sets the value of the field supported by the given object.
Declaration
public override void SetValue(object obj, object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The object whose field value will be set. |
object | value | The value to assign to the field. |
BindingFlags | invokeAttr | A field of |
Binder | binder | A set of properties that enables the binding, coercion of argument types, and invocation of members through reflection. If |
CultureInfo | culture | The software preferences of a particular culture. |
Overrides
Exceptions
Type | Condition |
---|---|
FieldAccessException | The caller does not have permission to access this field. |
TargetException | The |
ArgumentException | The field does not exist on the object. -or- The |
ToString()
Returns a string that represents the current object.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A string that represents the current object. |