c#通过赋值调用构造函数

c#通过赋值调用构造函数,c#,constructor,C#,Constructor,我可以通过赋值调用构造函数吗? 这是我的课 public class Person { public string sName; public string sAge; public Person (string sPerson) { //in sPerson i have Name and Age separate from , sName=sPerson.split(',')[0]; sAge=sPerson.split(',')[1]; } 在主代码中,我需要对我的对象进行值化,但我不

我可以通过赋值调用构造函数吗? 这是我的课

public class Person
{
public string sName;
public string sAge;

public Person (string sPerson)
{
//in sPerson i have Name and Age separate from ,
sName=sPerson.split(',')[0];
sAge=sPerson.split(',')[1];
}
在主代码中,我需要对我的对象进行值化,但我不能调用构造函数,有一种方法可以像这样调用构造函数吗

Person myObject = newPerson();
myPerson = sPeson;
}

是的,您可以提供一个可以容纳另一个人的

public Person (Person otherPerson)
{
    sName = otherPerson.sName;
    sAge = otherPerson.sAge;
}
您可以这样称呼它:

Person myObject = new Person(sPerson);

你是说
Person-myObject=myPerson?是一个打字错误(
newPerson
)吗?没有无参数构造函数。什么是
sPeson
myPerson
?我的物品价值化是什么意思?