コード例 #1
0
 public static void MergeExtensions(TypeExtension fromExt, ref TypeExtension toExt)
 {
     if (ReferenceEquals(fromExt, toExt))
     {
         return;
     }
     foreach (var attribute in fromExt.Attributes)
     {
         AttributeExtensionCollection attrs;
         if (toExt.Attributes.TryGetValue(attribute.Key, out attrs))
         {
             MergeExtensions(attribute.Value, ref attrs);
         }
         else
         {
             toExt.Attributes.Add(attribute.Key, attribute.Value);
         }
     }
     foreach (var member in fromExt.Members)
     {
         MemberExtension value;
         if (toExt.Members.TryGetValue(member.Key, out value))
         {
             MergeExtensions(member.Value, ref value);
         }
         else
         {
             toExt.Members.Add(member.Key, member.Value);
         }
     }
 }
コード例 #2
0
ファイル: ValueCollection.cs プロジェクト: epdumitru/mysqlib
        public void Add(string name, string value)
        {
            if (this != _null)
            {
                bool isType = name.EndsWith(TypeExtension.ValueName.TypePostfix);

                if (isType)
                {
                    Type   type      = Type.GetType(value, true);
                    string valueName =
                        name.Substring(0, name.Length - TypeExtension.ValueName.TypePostfix.Length);

                    _values[name] = type;

                    object val = _values[valueName];

                    if (val != null && val.GetType() != type)
                    {
                        _values[valueName] = val = TypeExtension.ChangeType(val.ToString(), type);

                        if (valueName == TypeExtension.ValueName.Value)
                        {
                            _value = val;
                        }
                    }
                }
                else
                {
                    Type   type = (Type)_values[name + TypeExtension.ValueName.TypePostfix];
                    object val  = value;

                    if (type != null && type != _value.GetType())
                    {
                        val = TypeExtension.ChangeType(value, type);
                    }

                    _values[name] = val;

                    if (name == TypeExtension.ValueName.Value)
                    {
                        _value = val;
                    }
                }
            }
        }
コード例 #3
0
ファイル: ExtensionList.cs プロジェクト: EIDSS/EIDSS6.1.0.45
 public void Add(TypeExtension typeInfo)
 {
     _types[typeInfo.Name] = typeInfo;
 }