Skip to main content

ITypeInfo.CreateMember(String, Type) Method

Dynamically adds a new member to the current type at run time.

Namespace: DevExpress.ExpressApp.DC

Assembly: DevExpress.ExpressApp.v26.1.dll

NuGet Package: DevExpress.ExpressApp

Declaration

IMemberInfo CreateMember(
    string memberName,
    Type memberType
)

Parameters

Name Type Description
memberName String

A string that holds the new member’s name.

memberType Type

A Type object that represents the type of the new member.

Returns

Type Description
IMemberInfo

An IMemberInfo object that supplies metadata on the created member.

Remarks

ITypeInfo typeInfo1 = typesInfo.FindTypeInfo(typeof(PersistentObject1));

IMemberInfo memberInfo0 = typeInfo1.FindMember("NewIntField");
if (memberInfo0 == null) {
    typeInfo1.CreateMember("NewIntField", typeof(int));
}
// ...
typesInfo.RefreshInfo(typeof(PersistentObject1));

View Example: XAF - Customize an XPO Business Model at Runtime

The following code snippets (auto-collected from DevExpress Examples) contain references to the CreateMember(String, Type) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also