Fixed the custom indexer example (setter return type is void)

This commit is contained in:
Jo Pearce 2015-10-12 14:07:56 +01:00
parent 1717ee9d88
commit 51f7c4f6a0

View File

@ -749,7 +749,7 @@ on a new line! ""Wow!"", the masses cried";
// It's also possible to define custom Indexers on objects. // It's also possible to define custom Indexers on objects.
// All though this is not entirely useful in this example, you // All though this is not entirely useful in this example, you
// could do bicycle[0] which yields "chris" to get the first passenger or // could do bicycle[0] which returns "chris" to get the first passenger or
// bicycle[1] = "lisa" to set the passenger. (of this apparent quattrocycle) // bicycle[1] = "lisa" to set the passenger. (of this apparent quattrocycle)
private string[] passengers = { "chris", "phil", "darren", "regina" }; private string[] passengers = { "chris", "phil", "darren", "regina" };
@ -760,7 +760,7 @@ on a new line! ""Wow!"", the masses cried";
} }
set { set {
return passengers[i] = value; passengers[i] = value;
} }
} }