asp.Netキー値対取値

1175 ワード

 
//     
public static Dictionary<string, string> ball = new Dictionary<string, string> { 
                                               { "2", "  " },
                                               { "1", "   " },
                                               { "19", "  " },
                                               { "57", "   " },
                                               { "165", "  " },
                                               { "22", "  " }};


        string key = context.Request.QueryString["q"].Trim(); 
        StringBuilder items = new StringBuilder();

        //     
        foreach(var k in ball.Keys)
        {
            if(ball[k].Contains(key))
            {
                items.Append("[" + k+ "]" +ball[k]).Append("
"); } } context.Response.Write(items.ToString());