Edit

Share via


IMemberCreationService.CreateField Method

Definition

Creates a field on the specified class by using the specified field name, field type, parameter types, attributes and literal initialization expression.

public:
 void CreateField(System::String ^ className, System::String ^ fieldName, Type ^ fieldType, cli::array <Type ^> ^ genericParameterTypes, System::CodeDom::MemberAttributes attributes, System::CodeDom::CodeSnippetExpression ^ initializationExpression, bool overwriteExisting);
public void CreateField (string className, string fieldName, Type fieldType, Type[] genericParameterTypes, System.CodeDom.MemberAttributes attributes, System.CodeDom.CodeSnippetExpression initializationExpression, bool overwriteExisting);
abstract member CreateField : string * string * Type * Type[] * System.CodeDom.MemberAttributes * System.CodeDom.CodeSnippetExpression * bool -> unit
Public Sub CreateField (className As String, fieldName As String, fieldType As Type, genericParameterTypes As Type(), attributes As MemberAttributes, initializationExpression As CodeSnippetExpression, overwriteExisting As Boolean)

Parameters

className
String

A string that defines the name of the class to add the field.

fieldName
String

A string that defines the name of the field.

fieldType
Type

The Type of the new field.

genericParameterTypes
Type[]

A Type array of any parameters associated with the field.

attributes
MemberAttributes

A MemberAttributes that defines the member attribute identifier for the field.

initializationExpression
CodeSnippetExpression

A CodeSnippetExpression that contains the literal expression of the field.

overwriteExisting
Boolean

true to delete any existing fields on className when creating the new field; otherwise, false.

Applies to