I have something like this hard-coded:
private string[,] m_RolesForUser = new string[,] {
{"John","President,Chair"},
{"Lisa","Chair"},
{"Mike","Executive,President,Chair"},
};
How would I fill this array if the datasource was made up of a table of roles and a table of users. A user could have multiple roles. Not sure what the syntax is to construct the code to support something like this.
Why not use a
Dictionaryof a list of objects here? C# is an OO language, so using objects is much more preferred. The example below is using strings to fit your example, but you could even create aPersonclass and aRoleclass and have aPersontied to a list ofRolesTo look for Lisa’s roles: