Пример #1
0
        public override ILTypeInstance Clone()
        {
            ILEnumTypeInstance ins = new ILEnumTypeInstance(type);

            ins.fields[0] = fields[0];
            return(ins);
        }
Пример #2
0
 public override bool Equals(object obj)
 {
     if (type != null)
     {
         var m = type.EqualsMethod;
         if (m != null && m is ILMethod)
         {
             using (var ctx = type.AppDomain.BeginInvoke(m))
             {
                 ctx.PushObject(this);
                 ctx.PushObject(obj);
                 ctx.Invoke();
                 return(ctx.ReadBool());
             }
         }
         else
         {
             if (this is ILEnumTypeInstance)
             {
                 if (obj is ILEnumTypeInstance)
                 {
                     ILEnumTypeInstance enum1 = (ILEnumTypeInstance)this;
                     ILEnumTypeInstance enum2 = (ILEnumTypeInstance)obj;
                     if (enum1.type == enum2.type)
                     {
                         bool res;
                         if (enum1.fields[0].ObjectType == ObjectTypes.Integer)
                         {
                             res = enum1.fields[0].Value == enum2.fields[0].Value;
                         }
                         else
                         {
                             res = enum1.fields[0] == enum2.fields[0];
                         }
                         return(res);
                     }
                     else
                     {
                         return(false);
                     }
                 }
                 else
                 {
                     return(base.Equals(obj));
                 }
             }
             else
             {
                 return(base.Equals(obj));
             }
         }
     }
     else
     {
         return(base.Equals(obj));
     }
 }