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

「dictionary entry」の例文・使い方・用例・文例

Weblio日本語例文用例辞書はプログラムで機械的に例文を生成しているため、不適切な項目が含まれていることもあります。ご了承くださいませ。


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

辞書ショートカット

すべての辞書の索引

「DictionaryEntry」の関連用語

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

   

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



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

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.
Tanaka Corpusのコンテンツは、特に明示されている場合を除いて、次のライセンスに従います:
 Creative Commons Attribution (CC-BY) 2.0 France.
この対訳データはCreative Commons Attribution 3.0 Unportedでライセンスされています。
浜島書店 Catch a Wave
Copyright © 1995-2025 Hamajima Shoten, Publishers. All rights reserved.
株式会社ベネッセコーポレーション株式会社ベネッセコーポレーション
Copyright © Benesse Holdings, Inc. All rights reserved.
研究社研究社
Copyright (c) 1995-2025 Kenkyusha Co., Ltd. All rights reserved.
日本語WordNet日本語WordNet
日本語ワードネット1.1版 (C) 情報通信研究機構, 2009-2010 License All rights reserved.
WordNet 3.0 Copyright 2006 by Princeton University. All rights reserved. License
日外アソシエーツ株式会社日外アソシエーツ株式会社
Copyright (C) 1994- Nichigai Associates, Inc., All rights reserved.
「斎藤和英大辞典」斎藤秀三郎著、日外アソシエーツ辞書編集部編
EDRDGEDRDG
This page uses the JMdict dictionary files. These files are the property of the Electronic Dictionary Research and Development Group, and are used in conformance with the Group's licence.

©2025 GRAS Group, Inc.RSS