本文整理汇总了C#中System.Collections.IDictionary类的典型用法代码示例。如果您正苦于以下问题:C# System.Collections.IDictionary类的具体用法?C# System.Collections.IDictionary怎么用?C# System.Collections.IDictionary使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
System.Collections.IDictionary类属于命名空间,在下文中一共展示了System.Collections.IDictionary类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VistaDBErrorLog
/// <summary>
/// Initializes a new instance of the <see cref="VistaDBErrorLog"/> class
/// using a dictionary of configured settings.
/// </summary>
public VistaDBErrorLog(IDictionary config)
{
if (config == null)
throw new ArgumentNullException("config");
_connectionString = ConnectionStringHelper.GetConnectionString(config);
//
// If there is no connection string to use then throw an
// exception to abort construction.
//
if (_connectionString.Length == 0)
throw new ApplicationException("Connection string is missing for the VistaDB error log.");
_databasePath = ConnectionStringHelper.GetDataSourceFilePath(_connectionString);
InitializeDatabase();
string appName = Mask.NullString((string)config["applicationName"]);
if (appName.Length > _maxAppNameLength)
{
throw new ApplicationException(string.Format(
"Application name is too long. Maximum length allowed is {0} characters.",
_maxAppNameLength.ToString("N0")));
}
ApplicationName = appName;
}
示例2: Selector
/// <summary> Ctor.</summary>
/// <param name="selector">Selector.
/// </param>
/// <param name="root">Root expression of the parsed selector.
/// </param>
/// <param name="identifiers">Identifiers used by the selector. The key
/// into the <tt>Map</tt> is name of the identifier and the value is an
/// instance of <tt>Identifier</tt>.
/// </param>
private Selector(System.String selector, IExpression root, System.Collections.IDictionary identifiers)
{
selector_ = selector;
root_ = root;
//UPGRADE_ISSUE: Method 'java.util.Collections.unmodifiableMap' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javautilCollectionsunmodifiableMap_javautilMap"'
identifiers_ = identifiers;
}
示例3: DictionaryToString
/// <summary>
/// Returns a string representation of this IDictionary.
/// </summary>
/// <remarks>
/// The string representation is a list of the collection's elements in the order
/// they are returned by its IEnumerator, enclosed in curly brackets ("{}").
/// The separator is a comma followed by a space i.e. ", ".
/// </remarks>
/// <param name="dict">Dictionary whose string representation will be returned</param>
/// <returns>A string representation of the specified dictionary or "null"</returns>
public static string DictionaryToString(IDictionary dict)
{
StringBuilder sb = new StringBuilder();
if (dict != null)
{
sb.Append("{");
int i = 0;
foreach (DictionaryEntry e in dict)
{
if (i > 0)
{
sb.Append(", ");
}
if (e.Value is IDictionary)
sb.AppendFormat("{0}={1}", e.Key.ToString(), DictionaryToString((IDictionary)e.Value));
else if (e.Value is IList)
sb.AppendFormat("{0}={1}", e.Key.ToString(), ListToString((IList)e.Value));
else
sb.AppendFormat("{0}={1}", e.Key.ToString(), e.Value.ToString());
i++;
}
sb.Append("}");
}
else
sb.Insert(0, "null");
return sb.ToString();
}
示例4: SqlErrorLog
/// <summary>
/// Initializes a new instance of the <see cref="SqlErrorLog"/> class
/// using a dictionary of configured settings.
/// </summary>
public SqlErrorLog(IDictionary config)
{
if (config == null)
throw new ArgumentNullException("config");
var connectionString = ConnectionStringHelper.GetConnectionString(config);
//
// If there is no connection string to use then throw an
// exception to abort construction.
//
if (connectionString.Length == 0)
throw new ApplicationException("Connection string is missing for the SQL error log.");
_connectionString = connectionString;
//
// Set the application name as this implementation provides
// per-application isolation over a single store.
//
var appName = config.Find("applicationName", string.Empty);
if (appName.Length > _maxAppNameLength)
{
throw new ApplicationException(string.Format(
"Application name is too long. Maximum length allowed is {0} characters.",
_maxAppNameLength.ToString("N0")));
}
ApplicationName = appName;
}
示例5: AccessErrorLog
/// <summary>
/// Initializes a new instance of the <see cref="AccessErrorLog"/> class
/// using a dictionary of configured settings.
/// </summary>
public AccessErrorLog(IDictionary config)
{
if (config == null)
throw new ArgumentNullException("config");
string connectionString = ConnectionStringHelper.GetConnectionString(config);
//
// If there is no connection string to use then throw an
// exception to abort construction.
//
if (connectionString.Length == 0)
throw new ApplicationException("Connection string is missing for the Access error log.");
_connectionString = connectionString;
InitializeDatabase();
//
// Set the application name as this implementation provides
// per-application isolation over a single store.
//
string appName = Mask.NullString((string)config["applicationName"]);
if (appName.Length > _maxAppNameLength)
{
throw new ApplicationException(string.Format(
"Application name is too long. Maximum length allowed is {0} characters.",
_maxAppNameLength.ToString("N0")));
}
ApplicationName = appName;
}
示例6: Create
/// <summary>
/// Creates an object given its text-based type specification
/// (see <see cref="System.Type.GetType"/> for notes on the
/// specification) and optionally sends it settings for
/// initialization.
/// </summary>
public static object Create(string typeSpec, IDictionary settings)
{
if (typeSpec.Length == 0)
return null;
Type type = Type.GetType(typeSpec, true);
return (settings == null) ?
Activator.CreateInstance(type) :
Activator.CreateInstance(type, new object[] { settings });
}
示例7: MockRAMDirectory
public MockRAMDirectory(System.IO.FileInfo dir) : base(dir)
{
if (openFiles == null)
{
openFiles = new System.Collections.Hashtable();
}
}
示例8: LiteralBool
static LiteralBool()
{
idMap_ = new System.Collections.Hashtable();
{
LiteralBool literal = new LiteralBool("true");
object tempObject;
tempObject = literal;
idMap_["true"] = tempObject;
System.Object generatedAux = tempObject;
object tempObject2;
tempObject2 = literal;
idMap_["TRUE"] = tempObject2;
System.Object generatedAux2 = tempObject2;
object tempObject3;
tempObject3 = literal;
idMap_["True"] = tempObject3;
System.Object generatedAux3 = tempObject3;
literal = new LiteralBool("false");
object tempObject4;
tempObject4 = literal;
idMap_["false"] = tempObject4;
System.Object generatedAux4 = tempObject4;
object tempObject5;
tempObject5 = literal;
idMap_["FALSE"] = tempObject5;
System.Object generatedAux5 = tempObject5;
object tempObject6;
tempObject6 = literal;
idMap_["False"] = tempObject6;
System.Object generatedAux6 = tempObject6;
}
}
示例9: Group
public Group(QName name, Field[] fields, bool optional)
: base(name, optional)
{
var expandedFields = new List<Field>();
var references = new List<StaticTemplateReference>();
for (int i = 0; i < fields.Length; i++)
{
if (fields[i] is StaticTemplateReference)
{
var currentTemplate = (StaticTemplateReference)fields[i];
Field[] referenceFields = currentTemplate.Template.Fields;
for (int j = 1; j < referenceFields.Length; j++)
expandedFields.Add(referenceFields[j]);
references.Add(currentTemplate);
}
else
{
expandedFields.Add(fields[i]);
}
}
this.fields = expandedFields.ToArray();
fieldDefinitions = fields;
fieldIndexMap = ConstructFieldIndexMap(this.fields);
fieldNameMap = ConstructFieldNameMap(this.fields);
fieldIdMap = ConstructFieldIdMap(this.fields);
introspectiveFieldMap = ConstructInstrospectiveFields(this.fields);
usesPresenceMap_Renamed_Field = DeterminePresenceMapUsage(this.fields);
staticTemplateReferences = references.ToArray();
}
示例10: if
public override System.Collections.BitArray Bits(IndexReader reader)
{
if (cache == null)
{
cache = new SupportClass.WeakHashTable();
}
System.Object cached = null;
lock (cache.SyncRoot)
{
// check cache
cached = cache[reader];
}
if (cached != null)
{
if (cached is System.Collections.BitArray)
{
return (System.Collections.BitArray) cached;
}
else if (cached is DocIdBitSet)
return ((DocIdBitSet) cached).GetBitSet();
// It would be nice to handle the DocIdSet case, but that's not really possible
}
System.Collections.BitArray bits = filter.Bits(reader);
lock (cache.SyncRoot)
{
// update cache
cache[reader] = bits;
}
return bits;
}
示例11: Bits
public override System.Collections.BitArray Bits(IndexReader reader)
{
if (cache == null)
{
cache = new System.Collections.Hashtable();
}
lock (cache.SyncRoot)
{
// check cache
System.Collections.BitArray cached = (System.Collections.BitArray) cache[reader];
if (cached != null)
{
return cached;
}
}
System.Collections.BitArray bits = filter.Bits(reader);
lock (cache.SyncRoot)
{
// update cache
cache[reader] = bits;
}
return bits;
}
示例12: AddEntry
public virtual void AddEntry(object key, object value)
{
if (map == null)
{
map = new NeoDatis.Tool.Wrappers.Map.OdbHashMap();
}
map.Add(key, value);
}
示例13: Close
public virtual void Close()
{
// Clear the hard refs; then, the only remaining refs to
// all values we were storing are weak (unless somewhere
// else is still using them) and so GC may reclaim them:
hardRefs = null;
t = null;
}
示例14: ValidationException
public ValidationException(Result result)
: base("There was a problem validating the submission. See data property for messages.")
{
this.data = new Dictionary<string, string>();
foreach (var message in result.FailureMessages)
{
this.data.Add(message.PropertyName, message.Message);
}
}
示例15: MultiFieldComparator
public MultiFieldComparator(string[] names, NeoDatis.Odb.Core.OrderByConstants orderByType
)
{
this.fieldNames = names;
map = new System.Collections.Hashtable();
this.way = orderByType.IsOrderByAsc() ? 1 : -1;
this.classIntrospector = NeoDatis.Odb.OdbConfiguration.GetCoreProvider().GetClassIntrospector
();
}