Remark : 2차원 배열에서 특정 비번 데이타 찾아보기
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
static void Main(string[] args) { int ServerType = 1; string ID = "SLAVE"; string sPassword = string.Empty; string[,] arrPassword = new string[,] { {"0","KING","12D324"}, {"1","QUEEN","34Q343"}, {"1","SLAVE","99S939"}, }; for (int i = 0; i < arrPassword.GetLength(0); i++) { if (arrPassword[i, 0] == ServerType.ToString() && arrPassword[i, 1] == ID) sPassword = arrPassword[i, 2].ToString(); } Console.WriteLine(sPassword); Console.ReadLine(); } 99S939 |