There is a piece of code that you want to use C # to represent. it is mainly an array problem.
$cursor = exequery( TD::conn( ), $query );while ( $rows = mysql_fetch_array( $cursor ) ){$a_bi[$tid]['selected'] = array( );$a_bi[$tid]['unselected'] = array( );}
$cursor = exequery( TD::conn( ), $query );while ( $rows = mysql_fetch_array( $cursor ) ){$tid = $rows['tid'];$rid = $rows['rid'];$report_name = $rows['report_name'];$report_limit_users = $rows['report_limit_users'];$s_type_name = "[".$a_bi[$tid]['name']."]";if ( strpos( $report_limit_users, $s_user ) === FALSE ){$a_report[$rid]['name'] = $s_type_name.$report_name;$a_bi[$tid]['selected'][$rid]['name'] = $s_type_name.$report_name;}else{$a_bi[$tid]['unselected'][$rid]['name'] = $s_type_name.$report_name;}}
It mainly refers to how to use the C # syntax to represent arrays. I have heard that you can use a dictionary, but I still don't know how to write it.
Reply to discussion (solution)
C # does not support multi-dimensional arrays?
Can you replace the key name with a subscript?
How can I write it? here is an example.
For example, $ a_bi [$ tid] ['selected'] [$ rid] ['name']
Writeable
A_bi [tid] [selected] [rid] [name]
Where tid and rid are read variables selected and name are custom variables, values 0, 1, 2, 3, 4 ....
The advantage of this literal translation is that it does not change the form of the original algorithm, and does not need to fully understand the algorithm principle.
The disadvantage is that there is a lot of invalid memory, but it can be optimized based on understanding the algorithm. Of course, that's the end.
In PHP, is this a multi-dimensional array? If you write in C #, it is estimated that an error will be reported. in C #, the ARRAYLIST can be indexed in one dimension. can it be used in multiple dimensions?
Dictionary >
A_bi = new
Dictionary > If it is a dictionary object, is this correct?