Interface IField
Represents a field declared in an application assembly, or declared in a third-party assembly and used the by application code.
public interface IField : IMember, IAttributeTarget, ICodeElement, IUsed
- Inherited Members
- Extension Methods
Properties (15)
FieldType
Gets the field type of this field. Gets null if the field type of this field is not in the scope of assemblies analyzed defined by IProject.CodeToAnalyze.
IType FieldType { get; }
Property Value
Remarks
This property getter has a constant time complexity.
- See Also
IsEnumField
Gets a value indicating whether this field is the field named "value__" of an enumeration.
bool IsEnumField { get; }
Property Value
IsEnumValue
Gets a value indicating whether this field is a value of an enumeration.
bool IsEnumValue { get; }
Property Value
IsEventDelegateObject
Gets a value indicating whether this field is an event delegate object. C# and VB.NET compilers define for each event an event adder, an event remover, and a field typed with a delegate class.
bool IsEventDelegateObject { get; }
Property Value
IsImmutable
Gets a value indicating whether this field is immutable.
bool IsImmutable { get; }
Property Value
Remarks
A static field is considered as immutable if it is private and if it is only assigned by the static constructor.
An instance field is considered as immutable if it is private and if it is only assigned by its type’s constructor(s) or its type’s static constructor.
Fields with a true value for IsLiteral, IsEnumValue or IsThirdParty are never considered as immutable to avoid noise in the search for immutable fields.
A field with a true value for IsInitOnly is always considered as immutable.
In addition, a field with a true value for IsImmutable can be safely marked as readonly.
IsInitOnly
Gets a value indicating whether this field is declared with the readonly keyword in C# and the ReadOnly keyword in VB.NET.
bool IsInitOnly { get; }
Property Value
IsLiteral
Gets a value indicating whether this field is declared with the const keyword in C# and the Const keyword in VB.NET.
bool IsLiteral { get; }
Property Value
IsRequired
Returns true if this field is defined as required.
bool IsRequired { get; }
Property Value
MethodsAssigningMe
Gets a sequence of methods that are assigning this field.
IEnumerable<IMethod> MethodsAssigningMe { get; }
Property Value
Remarks
For an instance field, constructor(s) of its class that assign the field are not counted.
For a static field, the class constructor that assigns the field is not counted.
This property getter has a O(this.MethodsUsingMe.Count) time complexity.
- See Also
MethodsReadingMeButNotAssigningMe
Gets a sequence of methods that are reading this field but not assigning it.
IEnumerable<IMethod> MethodsReadingMeButNotAssigningMe { get; }
Property Value
Remarks
This property getter has a O(this.MethodsUsingMe.Count + this.MethodsAssigningMe.Count) time complexity.
- See Also
MethodsUsingMe
Gets a sequence of methods that are using this field. A field is considered as used if it is read or assigned.
IEnumerable<IMethod> MethodsUsingMe { get; }
Property Value
Remarks
This property getter has a O(this.MethodsUsingMe.Count) time complexity.
- See Also
NbMethodsUsingMe
Gets the number of methods that use this field.
uint NbMethodsUsingMe { get; }
Property Value
ParentEvent
If this field is a backing field of an event, returns the parent IEvent object, else returns null.
IEvent ParentEvent { get; }
Property Value
ParentProperty
If this field is a backing field of a property, returns the parent IProperty object, else returns null.
IProperty ParentProperty { get; }
Property Value
SizeOfInst
Gets a numeric nullable value measuring this field contribution, in bytes, to the parent's IType.SizeOfInst value.
ushort? SizeOfInst { get; }
Property Value
- ushort?
null if this field is declared in a third-party assembly.
null if this field is static.
Otherwise returns this field SizeOfInst numeric value.
Remarks
SizeOfInst for an instance field with a reference type field (class, interface, delegate) counts for 4 bytes.
SizeOfInst for an instance field with a value type field (structure, int, byte, double...) is equal to the value type IType.SizeOfInst value.
SizeOfInst for a static field is null.