Delen via


IMutablePropertyBase.SetField(String) Method

Definition

Sets the underlying CLR field that this property should use.

public virtual void SetField (string fieldName);
public void SetField (string? fieldName);
abstract member SetField : string -> unit
override this.SetField : string -> unit
abstract member SetField : string -> unit
Public Overridable Sub SetField (fieldName As String)
Public Sub SetField (fieldName As String)

Parameters

fieldName
String

The name of the field to use.

Remarks

Backing fields are normally found by convention. This method is useful for setting backing fields explicitly in cases where the correct field is not found by convention.

By default, the backing field, if one is found or has been specified, is used when new objects are constructed, typically when entities are queried from the database. Properties are used for all other accesses. This can be changed by calling SetPropertyAccessMode(Nullable<PropertyAccessMode>).

See Backing fields for more information and examples.

Applies to