Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

C# Custom setter with parameter

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"
 
PREVIOUS NEXT
Tagged: #Custom #setter #parameter
ADD COMMENT
Topic
Name
5+6 =