known conditions:
public class ListSearchImportFieldModel
{
public string Field_Name { get; set; }
}
I need to implement the following method
Return properties of ListSearchImportFieldModel
as properties of ExpandoObject function as follows:
The incoming object (ExpandoObject
) may have 100 attributes, I only need a few attributes specified in the list (ListSearchImportFieldModel
).
Who can help me out, thank you very much!
I tried to let chatgpt do it for me, but it didn’t work
2
Answers
}
One could convert
ExpandoObject
toDictionary
and conveniently create newExpandoObject
based on just createdDitionary
by simply checking keys: