string formIdList = "8256, 8258, 8362, 8120, 8270, 8271, 8272, 8273, 8257, 8279, 8212, 8213, 8214, 8215, 8216, 8217, 8218, 8219, 8231, 8232, 8233, 8234, 8235, 8242, 8248, 8251, 8252, 8254, 8255, 8262, 8263, 8264, 8265, 8266, 8290, 8292, 8293, 8294, 8300, 8320, 8230, 8227, 8226, 8225, 8224, 8223, 8222, 8221, 8291, 8261, 8241, 8228, 8220, 8211, 8208, 8207, 8206, 8205, 8204, 8203, 8202, 8201, 8153, 8151, 8150, 8130, 8122, 8000, 8101, 8102, 8103";
var temp = formIdList.Split(',');
List<int> ids = new List<int>();
idsにIDをロードする必要があります。私はfor-loopを使うことができますが、もっと良い方法があると確信しています。リストにコンマで区切られた数字をロードする方法<int>でC#
一時配列のサイズを知っているので、リストをそのサイズに初期化して、内部配列のサイズ変更を減らしてください。そして「より良い」とは、少ないコードを意味しますか? For Loopは、最後にどのように実装されるかです。 – Bengie
[リストを作成するには、コンマ区切りの文字列からを作成するには?](http://stackoverflow.com/questions/910119/how-to-create-a-listt-from-a-comma-separated-string ) –
> Simon Fox:var asIntegers = arr.Select(s => int.Parse(s)); http://stackoverflow.com/questions/1297231/convert-string-to-int-in-one-string-of-code-using-linq – Bengie