C#のStringCollectionで指定されたインデックスで取得または設定します
StringCollectionで指定されたインデックスを取得または設定するには、コードは次のとおりです-
例
using System;
using System.Collections.Specialized;
public class Demo {
public static void Main() {
StringCollection strCol = new StringCollection();
String[] strArr = new String[] { "A", "B", "C", "D", "E", "F", "G", "H" };
Console.WriteLine("StringCollection elements...");
foreach (string str in strArr) {
Console.WriteLine(str);
}
strCol.AddRange(strArr);
Console.WriteLine("Element at 5th index = "+strCol[5]);
}
} 出力
これにより、次の出力が生成されます-
StringCollection elements... A B C D E F G H Element at 5th index = F
例
別の例を見てみましょう-
using System;
using System.Collections.Specialized;
public class Demo {
public static void Main() {
StringCollection strCol = new StringCollection();
String[] strArr = new String[] { "A", "B", "C", "D", "E", "F", "G", "H" };
Console.WriteLine("StringCollection elements...");
foreach (string str in strArr) {
Console.WriteLine(str);
}
strCol.AddRange(strArr);
Console.WriteLine("Element at 5th index = "+strCol[5]);
strCol[5] = "M";
Console.WriteLine("Element at 5th index (updated) = "+strCol[5]);
}
} 出力
これにより、次の出力が生成されます-
StringCollection elements... A B C D E F G H Element at 5th index = F Element at 5th index (updated) = M
-
C#のListDictionaryで指定されたキーに関連付けられた値を取得または設定します
ListDictionaryで指定されたキーに関連付けられた値を取得または設定するには、コードは次のとおりです- 例 using System; using System.Collections; using System.Collections.Specialized; public class Demo { public static void Main() { ListDictionary dict = new ListDictionary(); dict.Add("A
-
ルーターの設定方法
あなたがオタクなら、新しいルーターを設置する可能性があると、実際には少し興奮するかもしれません。結局、愛してはいけないことは何ですか?ネットワークに名前を付けたり、設定を微調整したり、速度を上げたり、通常は何ができるかを見て回るのを楽しんでください。しかし、それが水曜日の夜の楽しみのように聞こえない場合は、おそらく重要なものを設定して始めたいと思うでしょう。それでは、そうしましょう! ステップ1:ルーターをインターネットに接続する 最初のステップは、イーサネットケーブルをルーターに接続することです。おそらく「WAN」(ワイドエリアネットワーク)というラベルの付いたポートに接続します。も