📜  带参数的 C# 自定义设置器 - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:08.129000             🧑  作者: Mango

代码示例1
private string fullName;
public string this[string firstName]
{
    get { return fullName; }
    set { fullName = firstName + " " + value; }
}

// Sample usage...
foo["Jon"] = "Skeet";
string name = foo["Bar"]; // name is now "Jon Skeet"