Class IntegerKeyDictionaryConverter<TValue>
Generic version of IntegerKeyDictionaryConverter that works with a specific value type.
public class IntegerKeyDictionaryConverter<TValue> : IMakeXmlSource
Type Parameters
TValue
The type of values in the dictionary.
- Inheritance
-
IntegerKeyDictionaryConverter<TValue>
- Implements
- Inherited Members
- Extension Methods
Constructors
IntegerKeyDictionaryConverter()
Ctor.
public IntegerKeyDictionaryConverter()
IntegerKeyDictionaryConverter(XElement)
Ctor.
public IntegerKeyDictionaryConverter(XElement src)
Parameters
src
XElementXML
Properties
RawKeyList
Dont modify.
public List<string> RawKeyList { get; }
Property Value
RawKeyToIndex
Dont modify.
public Dictionary<string, int> RawKeyToIndex { get; }
Property Value
XName
Name for XML IO.
public static string XName { get; }
Property Value
Methods
GetIntegerKeyDictionary(Dictionary<string, TValue>)
Converts a dictionary with string keys to a dictionary with integer keys.
public Dictionary<int, TValue> GetIntegerKeyDictionary(Dictionary<string, TValue> rawKeyDictionary)
Parameters
rawKeyDictionary
Dictionary<string, TValue>The dictionary with string keys to convert.
Returns
- Dictionary<int, TValue>
A dictionary with integer keys.
GetRestoredDictionary(Dictionary<int, TValue>)
Converts a dictionary with integer keys back to a dictionary with string keys.
public Dictionary<string, TValue> GetRestoredDictionary(Dictionary<int, TValue> integerKeyDictionary)
Parameters
integerKeyDictionary
Dictionary<int, TValue>The dictionary with integer keys to convert.
Returns
- Dictionary<string, TValue>
A dictionary with string keys.
MakeXmlSource(string, string, bool)
Creates an XML representation of the object. This method may also generate additional resources such as related files.
public XElement MakeXmlSource(string baseDirectory, string relFile, bool exhibitionOnly)
Parameters
baseDirectory
stringThe base directory for resolving relative paths
relFile
stringThe relative file path for the XML source
exhibitionOnly
boolif true, the extended file creation is suppressed.
Returns
- XElement
An XML element representing the object's state
Remarks
For the demand of easy moving source folder (especially project folder) without configuration file path corruption, the relative file path is applied.
The baseDirectory
is typically the folder at the nearest configuration file folder.
Since the folder can be moving with the configuration file.