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

DictionaryEntry コンストラクタ

指定したキーと値を使用して、DictionaryEntry 型のインスタンス初期化します。

名前空間: System.Collections
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

public DictionaryEntry (
    Object key,
    Object value
)
public:
DictionaryEntry (
    Object^ key, 
    Object^ value
)
public DictionaryEntry (
    Object key, 
    Object value
)
public function DictionaryEntry (
    key : Object, 
    value : Object
)

パラメータ

key

キー/値ペア定義されているオブジェクト

value

key関連付けられている定義。

例外例外
例外種類条件

ArgumentNullException

.NET Frameworkバージョン1.0 または 1.1 であるにもかかわらずkeynull 参照 (Visual Basic では Nothing) です。

解説解説

.NET Framework 2.0場合keynull 参照 (Visual Basic では Nothing) になることがあります

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

DictionaryEntry プロパティ


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

  名前 説明
パブリック プロパティ Value キー/値ペア内の値を取得または設定します
参照参照

関連項目

DictionaryEntry 構造体
System.Collections 名前空間
IDictionary
IDictionaryEnumerator
System.Collections.Generic.KeyValuePair

DictionaryEntry メソッド


DictionaryEntry メンバ


DictionaryEntry 構造体

設定または取得できる、ディクショナリのキー/値ペア定義します

名前空間: System.Collections
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

<SerializableAttribute> _
<ComVisibleAttribute(True)> _
Public Structure DictionaryEntry
Dim instance As DictionaryEntry
[SerializableAttribute] 
[ComVisibleAttribute(true)] 
public struct DictionaryEntry
[SerializableAttribute] 
[ComVisibleAttribute(true)] 
public value class DictionaryEntry
/** @attribute SerializableAttribute() */ 
/** @attribute ComVisibleAttribute(true) */ 
public final class DictionaryEntry extends
 ValueType
JScript では、構造体使用できますが、新規に宣言することはできません。
解説解説

IDictionaryEnumerator.Entry メソッドは、この型のインスタンス返します

C# 言語foreach ステートメント (Visual C++場合for eachVisual Basic の場合For Each) は、コレクション内の各要素の型を必要とします。IDictionary の各要素キー/値ペアであるため、要素の型は、キーの型や値の型にはなりません。その代わり要素の型は DictionaryEntryなります。例 :

foreach (DictionaryEntry de in myHashtable)
 {...}
for each (DictionaryEntry^ de in myHashtable)
 {...}
For Each de As DictionaryEntry
 In myHashtable
   ...
Next de

foreach ステートメントは、列挙子のラッパーです。これは、コレクションからの読み取りのみを許可しコレクションへの書き込み防ぎます

使用例使用例

DictionaryEntry使用して Hashtable オブジェクト反復処理する例を次に示します

'A simple example for the DictionaryEntry structure.
Imports System
Imports System.Collections
Imports Microsoft.VisualBasic

Module Example

    Sub Main()

        ' Create a new hash table.
        '
        Dim openWith As New
 Hashtable()

        ' Add some elements to the hash table. There are no 
        ' duplicate keys, but some of the values are duplicates.
        openWith.Add("txt", "notepad.exe")
        openWith.Add("bmp", "paint.exe")
        openWith.Add("dib", "paint.exe")
        openWith.Add("rtf", "wordpad.exe")

        ' When you use For Each to enumerate hash table elements,
        ' the elements are retrieved as KeyValuePair objects.
        Console.WriteLine()
        For Each de As DictionaryEntry
 In openWith
            Console.WriteLine("Key = {0}, Value = {1}",
 _
                de.Key, de.Value)
        Next de

    End Sub

End Module

' This code example produces output similar to the following:
'
'Key = rtf, Value = winword.exe
'Key = txt, Value = notepad.exe
'Key = dib, Value = paint.exe
'Key = bmp, Value = paint.exe
// A simple example for the DictionaryEntry structure.
using System;
using System.Collections;

class Example
{
    public static void Main()
    {
        // Create a new hash table.
        //
        Hashtable openWith = new Hashtable();

        // Add some elements to the hash table. There are no 
        // duplicate keys, but some of the values are duplicates.
        openWith.Add("txt", "notepad.exe");
        openWith.Add("bmp", "paint.exe");
        openWith.Add("dib", "paint.exe");
        openWith.Add("rtf", "wordpad.exe");

        // When you use foreach to enumerate hash table elements,
        // the elements are retrieved as KeyValuePair objects.
        Console.WriteLine();
        foreach (DictionaryEntry de in openWith)
        {
            Console.WriteLine("Key = {0}, Value = {1}", de.Key, de.Value);
        }
    }
}

/* This code example produces output similar to the following:

Key = rtf, Value = wordpad.exe
Key = txt, Value = notepad.exe
Key = dib, Value = paint.exe
Key = bmp, Value = paint.exe
 */
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DictionaryEntry メンバ
System.Collections 名前空間
IDictionary
IDictionaryEnumerator
System.Collections.Generic.KeyValuePair


このページでは「.NET Framework クラス ライブラリ リファレンス」からDictionaryEntryを検索した結果を表示しています。
Weblioに収録されているすべての辞書からDictionaryEntryを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からDictionaryEntry を検索

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

辞書ショートカット

すべての辞書の索引

「DictionaryEntry」の関連用語

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

   

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



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

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

©2025 GRAS Group, Inc.RSS