CommaDelimitedStringCollectionとは? わかりやすく解説

CommaDelimitedStringCollection クラス

メモ : このクラスは、.NET Framework version 2.0新しく追加されたものです。

コンマ区切られ文字列要素コレクション表します。このクラス継承できません。

名前空間: System.Configuration
アセンブリ: System.Configuration (system.configuration.dll 内)
構文構文

Public NotInheritable Class
 CommaDelimitedStringCollection
    Inherits StringCollection
Dim instance As CommaDelimitedStringCollection
public sealed class CommaDelimitedStringCollection
 : StringCollection
public ref class CommaDelimitedStringCollection
 sealed : public StringCollection
public final class CommaDelimitedStringCollection
 extends StringCollection
public final class CommaDelimitedStringCollection
 extends StringCollection
解説解説
使用例使用例

CommaDelimitedStringCollection 型を使用する方法次のコード例示します

Imports System
Imports System.Collections.Generic
Imports System.Text
Imports System.Configuration
Imports System.Collections
Imports System.Web
Imports System.Web.Configuration
Imports System.Collections.Specialized

Namespace Samples.AspNet.Config
  Class CommaDelimitedStrCollection
    Shared Sub Main(ByVal
 args() As String)
      ' Display title and info.
      Console.WriteLine("ASP.NET Configuration Info")
      Console.WriteLine("Type: CommaDelimitedStringCollection")
      Console.WriteLine()

      ' Set the path of the config file.
      Dim configPath As String
 = "/aspnet"

      ' Get the Web application configuration object.
      Dim config As Configuration = _
      WebConfigurationManager.OpenWebConfiguration(configPath)

      ' Get the section related object.
      Dim configSection As AuthorizationSection
 = _
      CType(config.GetSection("system.web/authorization"),
 AuthorizationSection)

      ' Get the authorization rule collection.
      Dim authorizationRuleCollection As AuthorizationRuleCollection
 = _
      configSection.Rules()

      ' Create a CommaDelimitedStringCollection object.
      Dim myStrCollection As CommaDelimitedStringCollection
 = _
        New CommaDelimitedStringCollection()

      Dim i As Integer
      For i = 0 To authorizationRuleCollection.Count
 - 1 Step i + 1
        If authorizationRuleCollection.Get(i).Action.ToString().ToLower()
 _
          = "allow" Then
          ' Add values to the CommaDelimitedStringCollection object.
          myStrCollection.AddRange( _
            authorizationRuleCollection.Get(i).Users.ToString().Split( _
            ",".ToCharArray()))
        End If
      Next

      Console.WriteLine("Allowed Users: {0}", _
        myStrCollection.ToString())

      ' Count the elements in the collection.
      Console.WriteLine("Allowed User Count: {0}",
 _
        myStrCollection.Count)

      ' Call the Contains method.
      Console.WriteLine("Contains 'userName1': {0}", _
        myStrCollection.Contains("userName1"))

      ' Determine the index of an element
      ' in the collection.
      Console.WriteLine("IndexOf 'userName0': {0}", _
        myStrCollection.IndexOf("userName0"))

      ' Call IsModified.
      Console.WriteLine("IsModified: {0}", _
        myStrCollection.IsModified)

      ' Call IsReadyOnly.
      Console.WriteLine("IsReadOnly: {0}", _
        myStrCollection.IsReadOnly)

      Console.WriteLine()
      Console.WriteLine("Add a user name to the collection.")
      ' Insert a new element in the collection.
      myStrCollection.Insert(myStrCollection.Count, "userNameX")

      Console.WriteLine("Collection Value: {0}", _
        myStrCollection.ToString())

      Console.WriteLine()
      Console.WriteLine("Remove a user name from the collection.")
      ' Remove an element of the collection.
      myStrCollection.Remove("userNameX")

      Console.WriteLine("Collection Value: {0}", _
        myStrCollection.ToString())

      ' Display and wait
      Console.ReadLine()
    End Sub
  End Class
End Namespace
using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Configuration;
using System.Collections.Specialized;

namespace Samples.AspNet.Config
{
  class CommaDelimitedStrCollection
  {
    static void Main(string[]
 args)
    {
      // Display title and info.
      Console.WriteLine("ASP.NET Configuration Info");
      Console.WriteLine("Type: CommaDelimitedStringCollection");
      Console.WriteLine();

      // Set the path of the config file.
      string configPath = "/aspnet";

      // Get the Web application configuration object.
      Configuration config = 
        WebConfigurationManager.OpenWebConfiguration(configPath);

      // Get the section related object.
      AuthorizationSection configSection =
        (AuthorizationSection)config.GetSection("system.web/authorization");

      // Get the authorization rule collection.
      AuthorizationRuleCollection authorizationRuleCollection = 
        configSection.Rules;

      // Create a CommaDelimitedStringCollection object.
      CommaDelimitedStringCollection myStrCollection =
        new CommaDelimitedStringCollection();

      for (int i = 0; i < authorizationRuleCollection.Count;
 i++)
      {
        if (authorizationRuleCollection.Get(i).Action.ToString().ToLower()
 
          == "allow")
        {
          // Add values to the CommaDelimitedStringCollection object.
          myStrCollection.AddRange(
            authorizationRuleCollection.Get(i).Users.ToString().Split(
            ",".ToCharArray()));
        }
      }

      Console.WriteLine("Allowed Users: {0}",
        myStrCollection.ToString());

      // Count the elements in the collection.
      Console.WriteLine("Allowed User Count: {0}", 
        myStrCollection.Count);

      // Call the Contains method.
      Console.WriteLine("Contains 'userName1': {0}",
        myStrCollection.Contains("userName1"));

      // Determine the index of an element
      // in the collection.
      Console.WriteLine("IndexOf 'userName0': {0}",
        myStrCollection.IndexOf("userName0"));

      // Call IsModified.
      Console.WriteLine("IsModified: {0}",
        myStrCollection.IsModified);

      // Call IsReadyOnly.
      Console.WriteLine("IsReadOnly: {0}",
        myStrCollection.IsReadOnly);

      Console.WriteLine();
      Console.WriteLine("Add a user name to the collection.");
      // Insert a new element in the collection.
      myStrCollection.Insert(myStrCollection.Count, "userNameX");

      Console.WriteLine("Collection Value: {0}",
        myStrCollection.ToString());

      Console.WriteLine();
      Console.WriteLine("Remove a user name from the collection.");
      // Remove an element of the collection.
      myStrCollection.Remove("userNameX");

      Console.WriteLine("Collection Value: {0}",
        myStrCollection.ToString());

      // Display and wait
      Console.ReadLine();
    }
  }
}
継承階層継承階層
System.Object
   System.Collections.Specialized.StringCollection
    System.Configuration.CommaDelimitedStringCollection
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
CommaDelimitedStringCollection メンバ
System.Configuration 名前空間
StringCollection

CommaDelimitedStringCollection コンストラクタ

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

CommaDelimitedStringCollection クラス新しインスタンス作成します

名前空間: System.Configuration
アセンブリ: System.Configuration (system.configuration.dll 内)
構文構文

Dim instance As New CommaDelimitedStringCollection
public CommaDelimitedStringCollection ()
public:
CommaDelimitedStringCollection ()
public CommaDelimitedStringCollection ()
public function CommaDelimitedStringCollection
 ()
使用例使用例

CommaDelimitedStringCollection コンストラクタ使用する方法次のコード例示します。このコード例CommaDelimitedStringCollection クラス概要取り上げているコード例一部分です。

' Create a CommaDelimitedStringCollection object.
Dim myStrCollection As CommaDelimitedStringCollection
 = _
  New CommaDelimitedStringCollection()
// Create a CommaDelimitedStringCollection object.
CommaDelimitedStringCollection myStrCollection =
  new CommaDelimitedStringCollection();
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
CommaDelimitedStringCollection クラス
CommaDelimitedStringCollection メンバ
System.Configuration 名前空間

CommaDelimitedStringCollection プロパティ


パブリック プロパティパブリック プロパティ

  名前 説明
パブリック プロパティ Count  StringCollection に格納されている文字列の数を取得します。 ( StringCollection から継承されます。)
パブリック プロパティ IsModified コレクション変更されたかどうかを示す値を取得します
パブリック プロパティ IsReadOnly コレクション オブジェクト読み取り専用かどうかを示す値を取得します
パブリック プロパティ IsSynchronized  StringCollection へのアクセス同期されている (スレッド セーフである) かどうかを示す値を取得します。 ( StringCollection から継承されます。)
パブリック プロパティ Item インデックス基づいてコレクション内の文字列要素取得または設定します
パブリック プロパティ SyncRoot  StringCollection へのアクセス同期するために使用できるオブジェクト取得します。 ( StringCollection から継承されます。)
参照参照

関連項目

CommaDelimitedStringCollection クラス
System.Configuration 名前空間
StringCollection

CommaDelimitedStringCollection メソッド


パブリック メソッドパブリック メソッド

( プロテクト メソッド参照)
  名前 説明
パブリック メソッド Add コンマ区切りコレクションに文字列を追加します
パブリック メソッド AddRange 文字列配列すべての文字列コレクション追加します
パブリック メソッド Clear コレクションを空にします。
パブリック メソッド Clone コレクションコピー作成します
パブリック メソッド Contains  指定した文字列が StringCollection 内にあるかどうか確認します。 ( StringCollection から継承されます。)
パブリック メソッド CopyTo  1 次元文字列配列に、その配列内の指定したインデックス開始位置として StringCollection全体コピーします。 ( StringCollection から継承されます。)
パブリック メソッド Equals  オーバーロードされます2 つObject インスタンス等しかどうか判断します。 ( Object から継承されます。)
パブリック メソッド GetEnumerator  StringCollection反復処理する StringEnumerator を返します。 ( StringCollection から継承されます。)
パブリック メソッド GetHashCode  特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用適してます。 ( Object から継承されます。)
パブリック メソッド GetType  現在のインスタンスType取得します。 ( Object から継承されます。)
パブリック メソッド IndexOf  指定した文字列検索しStringCollection 内でその文字列最初に見つかった位置の 0 から始まるインデックス返します。 ( StringCollection から継承されます。)
パブリック メソッド Insert コレクション内の指定したインデックス位置に、文字列要素追加します
パブリック メソッド ReferenceEquals  指定した複数Object インスタンス同一かどうか判断します。 ( Object から継承されます。)
パブリック メソッド Remove 文字列要素コレクションから削除します
パブリック メソッド RemoveAt  StringCollection 内の指定したインデックスにある文字列削除します。 ( StringCollection から継承されます。)
パブリック メソッド SetReadOnly コレクション オブジェクト読み取り専用設定します
パブリック メソッド ToString オーバーライドされますオブジェクト文字列形式返します
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

CommaDelimitedStringCollection クラス
System.Configuration 名前空間
StringCollection

CommaDelimitedStringCollection メンバ

コンマ区切られ文字列要素コレクション表します。このクラス継承できません。

CommaDelimitedStringCollection データ型公開されるメンバを以下の表に示します


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド CommaDelimitedStringCollection CommaDelimitedStringCollection クラス新しインスタンス作成します
パブリック プロパティパブリック プロパティ
  名前 説明
パブリック プロパティ Count  StringCollection格納されている文字列の数を取得します。(StringCollection から継承されます。)
パブリック プロパティ IsModified コレクション変更されたかどうかを示す値を取得します
パブリック プロパティ IsReadOnly コレクション オブジェクト読み取り専用かどうかを示す値を取得します
パブリック プロパティ IsSynchronized  StringCollection へのアクセス同期されている (スレッド セーフである) かどうかを示す値を取得します。(StringCollection から継承されます。)
パブリック プロパティ Item インデックス基づいてコレクション内の文字列要素取得または設定します
パブリック プロパティ SyncRoot  StringCollection へのアクセス同期するために使用できるオブジェクト取得します。(StringCollection から継承されます。)
パブリック メソッドパブリック メソッド
( プロテクト メソッド参照)
  名前 説明
パブリック メソッド Add コンマ区切りコレクションに文字列を追加します
パブリック メソッド AddRange 文字列配列すべての文字列コレクション追加します
パブリック メソッド Clear コレクションを空にします。
パブリック メソッド Clone コレクションコピー作成します
パブリック メソッド Contains  指定した文字列が StringCollection 内にあるかどうか確認します。 (StringCollection から継承されます。)
パブリック メソッド CopyTo  1 次元文字列配列に、その配列内の指定したインデックス開始位置として StringCollection全体コピーします。 (StringCollection から継承されます。)
パブリック メソッド Equals  オーバーロードされます2 つObject インスタンス等しかどうか判断します。 (Object から継承されます。)
パブリック メソッド GetEnumerator  StringCollection反復処理する StringEnumerator を返します。 (StringCollection から継承されます。)
パブリック メソッド GetHashCode  特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用適してます。 (Object から継承されます。)
パブリック メソッド GetType  現在のインスタンスType取得します。 (Object から継承されます。)
パブリック メソッド IndexOf  指定した文字列検索しStringCollection 内でその文字列最初に見つかった位置の 0 から始まるインデックス返します。 (StringCollection から継承されます。)
パブリック メソッド Insert コレクション内の指定したインデックス位置に、文字列要素追加します
パブリック メソッド ReferenceEquals  指定した複数Object インスタンス同一かどうか判断します。 (Object から継承されます。)
パブリック メソッド Remove 文字列要素コレクションから削除します
パブリック メソッド RemoveAt  StringCollection 内の指定したインデックスにある文字列削除します。 (StringCollection から継承されます。)
パブリック メソッド SetReadOnly コレクション オブジェクト読み取り専用設定します
パブリック メソッド ToString オーバーライドされますオブジェクト文字列形式返します
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

CommaDelimitedStringCollection クラス
System.Configuration 名前空間
StringCollection



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「CommaDelimitedStringCollection」の関連用語

CommaDelimitedStringCollectionのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



CommaDelimitedStringCollectionのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS