本文整理汇总了C#中System.Collections.Specialized.HybridDictionary类的典型用法代码示例。如果您正苦于以下问题:C# HybridDictionary类的具体用法?C# HybridDictionary怎么用?C# HybridDictionary使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HybridDictionary类属于System.Collections.Specialized命名空间,在下文中一共展示了HybridDictionary类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RolePrincipal
protected RolePrincipal(SerializationInfo info, StreamingContext context)
{
this._Version = info.GetInt32("_Version");
this._ExpireDate = info.GetDateTime("_ExpireDate");
this._IssueDate = info.GetDateTime("_IssueDate");
try
{
this._Identity = info.GetValue("_Identity", typeof(IIdentity)) as IIdentity;
}
catch
{
}
this._ProviderName = info.GetString("_ProviderName");
this._Username = info.GetString("_Username");
this._IsRoleListCached = info.GetBoolean("_IsRoleListCached");
this._Roles = new HybridDictionary(true);
string str = info.GetString("_AllRoles");
if (str != null)
{
foreach (string str2 in str.Split(new char[] { ',' }))
{
if (this._Roles[str2] == null)
{
this._Roles.Add(str2, string.Empty);
}
}
}
}
示例2: InventoryComponent
/// <summary>
/// Initializes a new instance of the <see cref="InventoryComponent" /> class.
/// </summary>
/// <param name="userId">The user identifier.</param>
/// <param name="client">The client.</param>
/// <param name="userData">The user data.</param>
internal InventoryComponent(uint userId, GameClient client, UserData userData)
{
_mClient = client;
UserId = userId;
_floorItems = new HybridDictionary();
_wallItems = new HybridDictionary();
SongDisks = new HybridDictionary();
foreach (UserItem current in userData.Inventory)
{
if (current.BaseItem.InteractionType == Interaction.MusicDisc)
SongDisks.Add(current.Id, current);
if (current.IsWallItem)
_wallItems.Add(current.Id, current);
else
_floorItems.Add(current.Id, current);
}
_inventoryPets = new HybridDictionary();
_inventoryBots = new HybridDictionary();
_mAddedItems = new HybridDictionary();
_mRemovedItems = new HybridDictionary();
_isUpdated = false;
foreach (KeyValuePair<uint, RoomBot> bot in userData.Bots)
AddBot(bot.Value);
foreach (KeyValuePair<uint, Pet> pets in userData.Pets)
AddPets(pets.Value);
}
示例3: DbEnum
public DbEnum(int type)
{
IList dic = DbEntry
.From<LeafingEnum>()
.Where(CK.K["Type"] == type)
.OrderBy("Id")
.Select();
_dict = new HybridDictionary();
_vdic = new HybridDictionary();
_list = new string[dic.Count];
int n = 0;
int m = 0;
foreach (LeafingEnum e in dic)
{
_list[n] = e.Name;
if (e.Value != null)
{
m = (int)e.Value;
}
_dict[e.Name.ToLower()] = m;
_vdic[m] = e.Name;
n++;
m++;
}
}
示例4: ConsumerConnectionPointCollection
public ConsumerConnectionPointCollection(ICollection connectionPoints) {
if (connectionPoints == null) {
throw new ArgumentNullException("connectionPoints");
}
_ids = new HybridDictionary(connectionPoints.Count, true /* caseInsensitive */);
foreach (object obj in connectionPoints) {
if (obj == null) {
throw new ArgumentException(SR.GetString(SR.Collection_CantAddNull), "connectionPoints");
}
ConsumerConnectionPoint point = obj as ConsumerConnectionPoint;
if (point == null) {
throw new ArgumentException(SR.GetString(SR.Collection_InvalidType, "ConsumerConnectionPoint"),
"connectionPoints");
}
string id = point.ID;
if (!_ids.Contains(id)) {
InnerList.Add(point);
_ids.Add(id, point);
}
else {
throw new ArgumentException(SR.GetString(SR.WebPart_Collection_DuplicateID, "ConsumerConnectionPoint", id), "connectionPoints");
}
}
}
示例5: DbConnectionPoolGroup
internal DbConnectionPoolGroup(System.Data.Common.DbConnectionOptions connectionOptions, System.Data.ProviderBase.DbConnectionPoolGroupOptions poolGroupOptions)
{
this._connectionOptions = connectionOptions;
this._poolGroupOptions = poolGroupOptions;
this._poolCollection = new HybridDictionary(1, false);
this._state = 1;
}
示例6: InventoryComponent
internal InventoryComponent(uint UserId, GameClient Client, UserData UserData)
{
this.mClient = Client;
this.UserId = UserId;
this.floorItems = new HybridDictionary();
this.wallItems = new HybridDictionary();
this.discs = new HybridDictionary();
foreach (UserItem current in UserData.inventory)
{
if (current.GetBaseItem().InteractionType == InteractionType.musicdisc)
{
this.discs.Add(current.Id, current);
}
if (current.isWallItem)
{
this.wallItems.Add(current.Id, current);
}
else
{
this.floorItems.Add(current.Id, current);
}
}
this.InventoryPets = new SafeDictionary<uint, Pet>(UserData.pets);
this.InventoryBots = new SafeDictionary<uint, RoomBot>(UserData.Botinv);
this.mAddedItems = new HybridDictionary();
this.mRemovedItems = new HybridDictionary();
this.isUpdated = false;
}
示例7: HasReliableHashCode
[FriendAccessAllowed] // defined in Base, used in Core and Framework
internal static bool HasReliableHashCode(object item)
{
// null doesn't actually have a hashcode at all. This method can be
// called with a representative item from a collection - if the
// representative is null, we'll be pessimistic and assume the
// items in the collection should not be hashed.
if (item == null)
return false;
Type type = item.GetType();
Assembly assembly = type.Assembly;
HybridDictionary dictionary;
lock(_table)
{
dictionary = (HybridDictionary)_table[assembly];
}
if (dictionary == null)
{
dictionary = new HybridDictionary();
lock(_table)
{
_table[assembly] = dictionary;
}
}
return !dictionary.Contains(type);
}
示例8: GetRowsFromTable
public static TableRow[] GetRowsFromTable(Database msidb, string tableName)
{
if (!msidb.TableExists(tableName))
{
Trace.WriteLine(string.Format("Table name does {0} not exist Found.", tableName));
return new TableRow[0];
}
string query = string.Concat("SELECT * FROM `", tableName, "`");
using (var view = new ViewWrapper(msidb.OpenExecuteView(query)))
{
var /*<TableRow>*/ rows = new ArrayList(view.Records.Count);
ColumnInfo[] columns = view.Columns;
foreach (object[] values in view.Records)
{
HybridDictionary valueCollection = new HybridDictionary(values.Length);
for (int cIndex = 0; cIndex < columns.Length; cIndex++)
{
valueCollection[columns[cIndex].Name] = values[cIndex];
}
rows.Add(new TableRow(valueCollection));
}
return (TableRow[]) rows.ToArray(typeof(TableRow));
}
}
示例9: BasicPropertiesWrapper
public BasicPropertiesWrapper(IBasicProperties basicProperties)
{
ContentType = basicProperties.ContentType;
ContentEncoding = basicProperties.ContentEncoding;
DeliveryMode = basicProperties.DeliveryMode;
Priority = basicProperties.Priority;
CorrelationId = basicProperties.CorrelationId;
ReplyTo = basicProperties.ReplyTo;
Expiration = basicProperties.Expiration;
MessageId = basicProperties.MessageId;
Timestamp = basicProperties.Timestamp.UnixTime;
Type = basicProperties.Type;
UserId = basicProperties.UserId;
AppId = basicProperties.AppId;
ClusterId = basicProperties.ClusterId;
if (basicProperties.IsHeadersPresent())
{
Headers = new HybridDictionary();
foreach (DictionaryEntry header in basicProperties.Headers)
{
Headers.Add(header.Key, header.Value);
}
}
}
示例10: DataTypeParser
static DataTypeParser()
{
Types = new HybridDictionary();
Types[typeof(string)] = DataType.String;
Types[typeof(DateTime)] = DataType.DateTime;
Types[typeof(Date)] = DataType.Date;
Types[typeof(Time)] = DataType.Time;
Types[typeof(bool)] = DataType.Boolean;
Types[typeof(byte)] = DataType.Byte;
Types[typeof(sbyte)] = DataType.SByte;
Types[typeof(decimal)] = DataType.Decimal;
Types[typeof(double)] = DataType.Double;
Types[typeof(float)] = DataType.Single;
Types[typeof(int)] = DataType.Int32;
Types[typeof(uint)] = DataType.UInt32;
Types[typeof(long)] = DataType.Int64;
Types[typeof(ulong)] = DataType.UInt64;
Types[typeof(short)] = DataType.Int16;
Types[typeof(ushort)] = DataType.UInt16;
Types[typeof(Guid)] = DataType.Guid;
Types[typeof(byte[])] = DataType.Binary;
Types[typeof(Enum)] = DataType.Int32;
Types[typeof(DBNull)] = DataType.Single; // is that right?
}
示例11: MaxLength
/// <summary>
/// Obtém o tamanho máximo de um campo no banco de dados.
/// </summary>
/// <param name="table">A tabela</param>
/// <param name="field">O campo</param>
/// <returns>
/// O tamanho máximo do campo, ou
/// <c>null</c> caso não seja
/// possível obter o tamanho máximo.
/// </returns>
public NullableInt32 MaxLength(string table, string field)
{
Type t = GetModelType(table);
if (t == null) return null;
EnsureMetadataCache(t);
ActiveRecordModel model = ActiveRecordModel.GetModel(t);
if (model == null) return null;
IDictionary type2len = (IDictionary) type2lengths[t];
if (type2len == null)
{
lock (type2lengths.SyncRoot)
{
type2len = new HybridDictionary(true);
string physicalTableName = model.ActiveRecordAtt.Table;
foreach (PropertyModel p in model.Properties)
{
string physicalColumnName = p.PropertyAtt.Column;
type2len.Add(p.Property.Name, mdCache.MaxLength(physicalTableName, physicalColumnName));
}
type2lengths[t] = type2len;
}
}
if (!type2len.Contains(field))
return null;
return (int) type2len[field];
}
示例12: ConfigurationLockCollection
internal ConfigurationLockCollection(ConfigurationElement thisElement, ConfigurationLockCollectionType lockType,
string ignoreName, ConfigurationLockCollection parentCollection) {
_thisElement = thisElement;
_lockType = lockType;
internalDictionary = new HybridDictionary();
internalArraylist = new ArrayList();
_bModified = false;
_bExceptionList = _lockType == ConfigurationLockCollectionType.LockedExceptionList ||
_lockType == ConfigurationLockCollectionType.LockedElementsExceptionList;
_ignoreName = ignoreName;
if (parentCollection != null) {
foreach (string key in parentCollection) // seed the new collection
{
Add(key, ConfigurationValueFlags.Inherited); // add the local copy
if (_bExceptionList) {
if (SeedList.Length != 0)
SeedList += ",";
SeedList += key;
}
}
}
}
示例13: AnalyzeEnum
private void AnalyzeEnum( Type enumType )
{
_enumName = enumType.Name;
R.FieldInfo[] fieldInfos = enumType.GetFields( BindingFlags.Static | BindingFlags.Public );
_namedValues = new HybridDictionary( fieldInfos.Length, false );
_valuedNames = new HybridDictionary( fieldInfos.Length, false );
foreach( R.FieldInfo fi in fieldInfos )
{
if( ( fi.Attributes & EnumField ) == EnumField )
{
string name = fi.Name;
object value = fi.GetValue( null );
Attribute[] attrs =
Attribute.GetCustomAttributes( fi, typeof( XmlEnumAttribute ) );
if( attrs.Length > 0 )
{
XmlEnumAttribute attr = (XmlEnumAttribute)attrs[0];
name = attr.Name;
}
_namedValues.Add( name, value );
if( !_valuedNames.Contains( value ))
_valuedNames.Add( value, name );
}
}
}
示例14: DbConnectionPoolGroup
internal DbConnectionPoolGroup(DbConnectionOptions connectionOptions, DbConnectionPoolGroupOptions poolGroupOptions)
{
this._connectionOptions = connectionOptions;
this._poolGroupOptions = poolGroupOptions;
this._poolCollection = new HybridDictionary(1, false);
this._state = 1;
}
示例15: LookupMember
private void LookupMember(string name, HybridDictionary visitedAliases, out PSMemberInfo returnedMember, out bool hasCycle)
{
returnedMember = null;
if (base.instance == null)
{
throw new ExtendedTypeSystemException("AliasLookupMemberOutsidePSObject", null, ExtendedTypeSystem.AccessMemberOutsidePSObject, new object[] { name });
}
PSMemberInfo info = PSObject.AsPSObject(base.instance).Properties[name];
if (info == null)
{
throw new ExtendedTypeSystemException("AliasLookupMemberNotPresent", null, ExtendedTypeSystem.MemberNotPresent, new object[] { name });
}
PSAliasProperty property = info as PSAliasProperty;
if (property == null)
{
hasCycle = false;
returnedMember = info;
}
else if (visitedAliases.Contains(name))
{
hasCycle = true;
}
else
{
visitedAliases.Add(name, name);
this.LookupMember(property.ReferencedMemberName, visitedAliases, out returnedMember, out hasCycle);
}
}