private void SetReadOnlyDictionary() { lock (_sync) { ReadOnly = new DictionaryReadOnly <TKey, TValue>(new SortedList <TKey, TValue>(_dict, _dict.Comparer)); } }
/// <summary> /// email address /// </summary> /// <param name="email"></param> public SupportFileTypesRule(string fileName, string errorMessagePrefix, DictionaryReadOnly <string, string> supporedTypesLookUp) { _fileName = fileName; _supportedTypes = supporedTypesLookUp; _errorMessagePrefix = errorMessagePrefix; }
static ImageSupportedFileTypesRule() { IDictionary <string, string> supportedTypes = new Dictionary <string, string>(); supportedTypes.Add("gif", "gif"); supportedTypes.Add("jpeg", "jpeg"); supportedTypes.Add("tiff", "tiff"); supportedTypes.Add("png", "png"); supportedTypes.Add("jpg", "jpg"); _readOnlySupportedTypes = new DictionaryReadOnly <string, string>(supportedTypes); }
/// <summary> /// Initialize default instance. /// </summary> /// <param name="text"></param> public void Init(string text, string escapeChar, string[] tokens, string[] whiteSpaceTokens, string[] eolTokens) { Reset(); _text = text; LAST_POSITION = _text.Length - 1; _tokens = tokens.ToDictionary(); _whiteSpaceChars = whiteSpaceTokens.ToDictionary(); _eolChars = eolTokens.ToDictionary(); _readonlyEolMap = new DictionaryReadOnly <string, string>(_eolChars); _readonlyWhiteSpaceMap = new DictionaryReadOnly <string, string>(_whiteSpaceChars); }
/// <summary> /// Initialize default instance. /// </summary> /// <param name="text"></param> public void Init(string text, string escapeChar, string[] tokens, string[] whiteSpaceTokens, string[] eolTokens) { Reset(); _text = text; LAST_POSITION = _text.Length - 1; _tokens = tokens.ToDictionary(); _whiteSpaceChars = whiteSpaceTokens.ToDictionary(); _eolChars = eolTokens.ToDictionary(); _readonlyEolMap = new DictionaryReadOnly<string, string>(_eolChars); _readonlyWhiteSpaceMap = new DictionaryReadOnly<string, string>(_whiteSpaceChars); }