Click or drag to resize

ScriptContextTryGetOrCreateField(String, FieldItemType, FieldItem) Method

Gets or creates the field matching both the given name and field type. A return value indicates an existing field with type was found or a new field instance was created successfully.

Namespace: Compiled.EDD.Scripting
Assembly: Compiled.EDD.Scripting (in Compiled.EDD.Scripting.dll) Version: 9.0.0.0-142fa9725
Syntax
C#
public bool TryGetOrCreateField(
	string fieldName,
	FieldItemType fieldType,
	out FieldItem outputField
)

Parameters

fieldName  String
The name of the field.
fieldType  FieldItemType
The data type of the field.
outputField  FieldItem
When this method returns, contains the result of an existing or created field.

Return Value

Boolean
true if a field with the name and field type found, or created by this method; otherwise, false.

Implements

IScriptContextTryGetOrCreateField(String, FieldItemType, FieldItem)
Exceptions
ExceptionCondition
ExceptionThrown when a matching field name exists but the field type does not match the field type.
Remarks
Calls GetField(String) to check if the field exists, then checks if the FieldItemType matches the existing field. When neither match, calls CreateField(String, FieldItemType) to create a new field instance.
See Also