我想创建一个方法,接收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();
}