Edit

Share via


FormatterServices.PopulateObjectMembers Method

Definition

Populates the specified object with values for each field drawn from the data array of objects.

public:
 static System::Object ^ PopulateObjectMembers(System::Object ^ obj, cli::array <System::Reflection::MemberInfo ^> ^ members, cli::array <System::Object ^> ^ data);
public static object PopulateObjectMembers (object obj, System.Reflection.MemberInfo[] members, object?[] data);
public static object PopulateObjectMembers (object obj, System.Reflection.MemberInfo[] members, object[] data);
[System.Security.SecurityCritical]
public static object PopulateObjectMembers (object obj, System.Reflection.MemberInfo[] members, object[] data);
static member PopulateObjectMembers : obj * System.Reflection.MemberInfo[] * obj[] -> obj
[<System.Security.SecurityCritical>]
static member PopulateObjectMembers : obj * System.Reflection.MemberInfo[] * obj[] -> obj
Public Shared Function PopulateObjectMembers (obj As Object, members As MemberInfo(), data As Object()) As Object

Parameters

obj
Object

The object to populate.

members
MemberInfo[]

An array of MemberInfo that describes which fields and properties to populate.

data
Object[]

An array of Object that specifies the values for each field and property to populate.

Returns

The newly populated object.

Attributes

Exceptions

The obj, members, or data parameter is null.

An element of members is null.

The length of members does not match the length of data.

An element of members is not an instance of FieldInfo.

The caller does not have the required permission.

Remarks

If an element in data is null, PopulateObjectMembers does not write anything to that field.

Applies to