What is it called when your class has a root collection and how do you do it in C#?
-
public class UserSettings { public UserSettings[] { } } so that I can access it like so: Console.WriteLine(UserSetting["ITEMNAME"]); Thank you to everyone in advance.
QMuffs
What are you trying to accomplish?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
-
What are you trying to accomplish?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
I think it is called an accessor to my class but I'm not sure. Let's say I have this UserSettings["ITEMNAME"] When it does this I have to Validate the ItemName and return the default if it doesn't exist. I basically want the [] to act as a property in a way. Would it be an operator?
QMuffs
-
public class UserSettings { public UserSettings[] { } } so that I can access it like so: Console.WriteLine(UserSetting["ITEMNAME"]); Thank you to everyone in advance.
QMuffs
I think C# Indexers can help you. Please check this link to know more about Indexers Indexer In C#[^]
Software - Bundle of bugs covered with features.
-
I think C# Indexers can help you. Please check this link to know more about Indexers Indexer In C#[^]
Software - Bundle of bugs covered with features.