Show / Hide Table of Contents

    Class DictionaryExtensions

    Inheritance
    System.Object
    DictionaryExtensions
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Lucene.Net.Support
    Assembly: Lucene.Net.dll
    Syntax
    public static class DictionaryExtensions

    Methods

    | Improve this Doc View Source

    EntrySet<TKey, TValue>(IDictionary<TKey, TValue>)

    Declaration
    public static ISet<KeyValuePair<TKey, TValue>> EntrySet<TKey, TValue>(this IDictionary<TKey, TValue> dict)
    Parameters
    Type Name Description
    System.Collections.Generic.IDictionary<TKey, TValue> dict
    Returns
    Type Description
    System.Collections.Generic.ISet<System.Collections.Generic.KeyValuePair<TKey, TValue>>
    Type Parameters
    Name Description
    TKey
    TValue
    | Improve this Doc View Source

    Load(IDictionary<String, String>, Stream)

    Loads properties from the specified System.IO.Stream. The encoding is ISO8859-1.

    Declaration
    public static void Load(this IDictionary<string, string> dict, Stream input)
    Parameters
    Type Name Description
    System.Collections.Generic.IDictionary<System.String, System.String> dict

    This dictionary.

    System.IO.Stream input

    The System.IO.Stream.

    Remarks

    The Properties file is interpreted according to the following rules:

    • Empty lines are ignored.
    • Lines starting with either a "#" or a "!" are comment lines and are ignored.
    • A backslash at the end of the line escapes the following newline character ("\r", "\n", "\r\n"). If there's a whitespace after the backslash it will just escape that whitespace instead of concatenating the lines. This does not apply to comment lines.
    • A property line consists of the key, the space between the key and the value, and the value. The key goes up to the first whitespace, "=" or ":" that is not escaped. The space between the key and the value contains either one whitespace, one "=" or one ":" and any number of additional whitespaces before and after that character. The value starts with the first character after the space between the key and the value.
    • Following escape sequences are recognized: "\ ", "\", "\r", "\n", "!", "#", "\t", "\b", "\f", and "\uXXXX" (unicode character).

    This method is to mimic and interoperate with the Properties class in Java, which is essentially a string dictionary that natively supports importing and exporting to this format.

    Exceptions
    Type Condition
    System.IO.IOException

    If error occurs during reading from the System.IO.Stream.

    | Improve this Doc View Source

    Put<TKey, TValue>(IDictionary<TKey, TValue>, TKey, TValue)

    Declaration
    public static TValue Put<TKey, TValue>(this IDictionary<TKey, TValue> dict, TKey key, TValue value)
    Parameters
    Type Name Description
    System.Collections.Generic.IDictionary<TKey, TValue> dict
    TKey key
    TValue value
    Returns
    Type Description
    TValue
    Type Parameters
    Name Description
    TKey
    TValue
    | Improve this Doc View Source

    PutAll<TKey, TValue>(IDictionary<TKey, TValue>, IEnumerable<KeyValuePair<TKey, TValue>>)

    Declaration
    public static void PutAll<TKey, TValue>(this IDictionary<TKey, TValue> dict, IEnumerable<KeyValuePair<TKey, TValue>> kvps)
    Parameters
    Type Name Description
    System.Collections.Generic.IDictionary<TKey, TValue> dict
    System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey, TValue>> kvps
    Type Parameters
    Name Description
    TKey
    TValue
    | Improve this Doc View Source

    Store(IDictionary<String, String>, Stream, String)

    Stores the mappings in this Properties to the specified System.IO.Stream, putting the specified comment at the beginning. The output from this method is suitable for being read by the Load(IDictionary<String, String>, Stream) method.

    Declaration
    public static void Store(this IDictionary<string, string> dict, Stream output, string comments)
    Parameters
    Type Name Description
    System.Collections.Generic.IDictionary<System.String, System.String> dict

    This dictionary.

    System.IO.Stream output

    The output System.IO.Stream to write to.

    System.String comments

    The comments to put at the beginning.

    Exceptions
    Type Condition
    System.IO.IOException

    If an error occurs during the write to the System.IO.Stream.

    System.InvalidCastException

    If the key or value of a mapping is not a System.String.

    • Improve this Doc
    • View Source
    Back to top Copyright © 2019 Licensed to the Apache Software Foundation (ASF)