共用方式為


FormatterServices.PopulateObjectMembers 方法

定義

將取自物件資料陣列每個欄位的值填入指定物件。

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

參數

obj
Object

要填入的物件。

members
MemberInfo[]

MemberInfo 的陣列,描述要填入哪些欄位和屬性。

data
Object[]

Object 的陣列,指定要填入每個欄位和屬性的值。

傳回

新填入的物件。

屬性

例外狀況

objmembersdata 參數是 null

members 的項目是 null

members 的長度不符合 data 的長度。

members 的元素不是 FieldInfo 的執行個體。

呼叫端沒有必要的權限。

備註

如果 中的 data 專案為 nullPopulateObjectMembers 則不會將任何專案寫入該欄位。

適用於