Method Load
Load(IDictionary<String, String>, Stream)
Loads properties from the specified
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.