本文整理汇总了C#中System.Collections.IDictionary类的典型用法代码示例。如果您正苦于以下问题:C# System.Collections.IDictionary类的具体用法?C# System.Collections.IDictionary怎么用?C# System.Collections.IDictionary使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
System.Collections.IDictionary类属于命名空间,在下文中一共展示了System.Collections.IDictionary类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:kjana83,项目名称:ELMAH,代码行数:34,代码来源:VistaDBErrorLog.cs
示例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;
}
开发者ID:jamsel,项目名称:jamsel,代码行数:16,代码来源:Selector.cs
示例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();
}
开发者ID:nikola-v,项目名称:jaustoolset,代码行数:40,代码来源:CollectionUtils.cs
示例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;
}
开发者ID:ramsenthil18,项目名称:elmah,代码行数:38,代码来源:SqlErrorLog.cs
示例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;
}
开发者ID:buddydvd,项目名称:elmah-mirror,代码行数:39,代码来源:AccessErrorLog.cs
示例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 });
}
开发者ID:JBetser,项目名称:Imagenius_SDK,代码行数:17,代码来源:ServiceProviderFactory.cs
示例7: GetString
private static string GetString(IDictionary options, string name)
{
Debug.Assert(name != null);
if (options == null)
return string.Empty;
object value = options[name];
if (value == null)
return string.Empty;
return value.ToString() ?? string.Empty;
}
开发者ID:stewart-rae,项目名称:Elmah,代码行数:14,代码来源:SecurityConfiguration.cs
示例8: GetConnectionString
/// <summary>
/// Gets the connection string from the given configuration
/// dictionary.
/// </summary>
public static string GetConnectionString(IDictionary config)
{
Debug.Assert(config != null);
#if !NET_1_1 && !NET_1_0
//
// First look for a connection string name that can be
// subsequently indexed into the <connectionStrings> section of
// the configuration to get the actual connection string.
//
string connectionStringName = (string)config["connectionStringName"] ?? string.Empty;
if (connectionStringName.Length > 0)
{
ConnectionStringSettings settings = ConfigurationManager.ConnectionStrings[connectionStringName];
if (settings == null)
return string.Empty;
return settings.ConnectionString ?? string.Empty;
}
#endif
//
// Connection string name not found so see if a connection
// string was given directly.
//
string connectionString = Mask.NullString((string)config["connectionString"]);
if (connectionString.Length > 0)
return connectionString;
//
// As a last resort, check for another setting called
// connectionStringAppKey. The specifies the key in
// <appSettings> that contains the actual connection string to
// be used.
//
string connectionStringAppKey = Mask.NullString((string)config["connectionStringAppKey"]);
if (connectionStringAppKey.Length == 0)
return string.Empty;
return Configuration.AppSettings[connectionStringAppKey];
}
开发者ID:ThePublicTheater,项目名称:NYSF,代码行数:52,代码来源:ConnectionStringHelper.cs
示例9: MemoryErrorLog
/// <summary>
/// Initializes a new instance of the <see cref="MemoryErrorLog"/> class
/// using a dictionary of configured settings.
/// </summary>
public MemoryErrorLog(IDictionary config)
{
if (config == null)
{
_size = DefaultSize;
return;
}
string sizeString = (string)config["size"] ?? "";
if (sizeString.Length == 0)
{
_size = DefaultSize;
return;
}
_size = Convert.ToInt32(sizeString, CultureInfo.InvariantCulture);
_size = Math.Max(0, Math.Min(MaximumSize, _size));
}
开发者ID:jtbandes,项目名称:StackExchange.DataExplorer,代码行数:22,代码来源:MemoryErrorLog.cs
示例10: GetConnectionString
/// <summary>
/// Gets the connection string from the given configuration
/// dictionary.
/// </summary>
public static string GetConnectionString(IDictionary config)
{
Debug.Assert(config != null);
//
// First look for a connection string name that can be
// subsequently indexed into the <connectionStrings> section of
// the configuration to get the actual connection string.
//
string connectionStringName = config.Find("connectionStringName", string.Empty);
if (connectionStringName.Length > 0)
{
ConnectionStringSettings settings = ConfigurationManager.ConnectionStrings[connectionStringName];
if (settings == null)
return string.Empty;
return settings.ConnectionString ?? string.Empty;
}
//
// Connection string name not found so see if a connection
// string was given directly.
//
var connectionString = config.Find("connectionString", string.Empty);
if (connectionString.Length > 0)
return connectionString;
//
// As a last resort, check for another setting called
// connectionStringAppKey. The specifies the key in
// <appSettings> that contains the actual connection string to
// be used.
//
var connectionStringAppKey = config.Find("connectionStringAppKey", string.Empty);
return connectionStringAppKey.Length > 0
? ConfigurationManager.AppSettings[connectionStringAppKey]
: string.Empty;
}
开发者ID:AkosLukacs,项目名称:ElmahMod,代码行数:47,代码来源:ConnectionStringHelper.cs
示例11: MockRAMDirectory
public MockRAMDirectory(System.IO.FileInfo dir) : base(dir)
{
if (openFiles == null)
{
openFiles = new System.Collections.Hashtable();
}
}
开发者ID:vikasraz,项目名称:indexsearchutils,代码行数:7,代码来源:MockRAMDirectory.cs
示例12: 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;
}
}
开发者ID:jamsel,项目名称:jamsel,代码行数:33,代码来源:LiteralBool.cs
示例13: 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();
}
开发者ID:marlonbomfim,项目名称:openfastdotnet,代码行数:29,代码来源:Group.cs
示例14: 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;
}
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:35,代码来源:CachingWrapperFilter.cs
示例15: 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;
}
开发者ID:zweib730,项目名称:beagrep,代码行数:27,代码来源:CachingWrapperFilter.cs
示例16: AddEntry
public virtual void AddEntry(object key, object value)
{
if (map == null)
{
map = new NeoDatis.Tool.Wrappers.Map.OdbHashMap();
}
map.Add(key, value);
}
开发者ID:ekicyou,项目名称:pasta,代码行数:8,代码来源:Dictionnary.cs
示例17: 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;
}
开发者ID:andylaudotnet,项目名称:StockFoo,代码行数:8,代码来源:CloseableThreadLocal.cs
示例18: 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);
}
}
开发者ID:FeodorFitsner,项目名称:Archimedes,代码行数:9,代码来源:ValidationException.cs
示例19: 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
();
}
开发者ID:ekicyou,项目名称:pasta,代码行数:9,代码来源:MultiFieldComparator.cs
示例20: AttributeSource
/// <summary> An AttributeSource that uses the same attributes as the supplied one.</summary>
public AttributeSource(AttributeSource input)
{
if (input == null)
{
throw new System.ArgumentException("input AttributeSource must not be null");
}
this.attributes = input.attributes;
this.attributeImpls = input.attributeImpls;
this.factory = input.factory;
}
开发者ID:BackupTheBerlios,项目名称:lyra2-svn,代码行数:11,代码来源:AttributeSource.cs
注:本文中的System.Collections.IDictionary类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论