我想创建一个接收 3 个字符串作为参数并返回一个对象的方法,该对象包含他们引用这些字符串的三个属性。
没有要复制的“旧对象”。应在此方法中创建属性。
是用反射在C#中做到这一点吗?如果是这样,怎么做?下面是你喜欢的,我做不到。
protected Object getNewObject(String name, String phone, String email)
{
Object newObject = new Object();
... //I can not add the variables that received by the object parameter here.
return newObject();
}