Show / Hide Table of Contents

    Class DictionaryExtensions

    Inheritance
    System.Object
    DictionaryExtensions
    Namespace: Lucene.Net.Support
    Assembly: Lucene.Net.dll
    Syntax
    public static class DictionaryExtensions : object

    Methods

    | Improve this Doc View Source

    Load(IDictionary<String, String>, Stream)

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

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

    This dictionary.

    Stream input

    The .

    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.

    | 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
    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
    IDictionary<TKey, TValue> dict
    IEnumerable<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 , 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
    IDictionary<System.String, System.String> dict

    This dictionary.

    Stream output

    The output to write to.

    System.String comments

    The comments to put at the beginning.

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