I have a (dump) question regarding VB / C #
I often use third-party classes, where I can access the child by specifying only an identifier or key.
Example:
Instead of writing:
DataRow row = GetAPopulatedDataRowSomeWhere();
Object result = row.Items[1];
Object result = row.Items["colName"];
I use this code to access elements:
DataRow row = GetAPopulatedDataRowSomeWhere();
Object result = row[1];
Object result = row["colName"];
Can someone tell me what the class should look like to support this syntax? My own class has a dictionary that I want to access this way.
MyClass["key"];
MyClass.SubItems["key"];
source
share