Mono.Debugger.Soft.TypeMirror.GetFields C# (CSharp) Method

GetFields() public method

public GetFields ( ) : Mono.Debugger.Soft.FieldInfoMirror[]
return Mono.Debugger.Soft.FieldInfoMirror[]
		public FieldInfoMirror[] GetFields () {
			if (fields != null)
				return fields;

			string[] names;
			long[] types;
			int[] attrs;
			long[] ids = vm.conn.Type_GetFields (id, out names, out types, out attrs);

			FieldInfoMirror[] res = new FieldInfoMirror [ids.Length];
			for (int i = 0; i < res.Length; ++i)
				res [i] = new FieldInfoMirror (this, ids [i], names [i], vm.GetType (types [i]), (FieldAttributes)attrs [i]);

			fields = res;
			return fields;
		}

Usage Example

示例#1
0
        internal static CustomAttributeDataMirror[] Create(VirtualMachine vm, CattrInfo[] info)
        {
            var res = new CustomAttributeDataMirror [info.Length];

            for (int i = 0; i < info.Length; ++i)
            {
                CattrInfo    attr      = info [i];
                MethodMirror ctor      = vm.GetMethod(attr.ctor_id);
                var          ctor_args = new object [attr.ctor_args.Length];
                for (int j = 0; j < ctor_args.Length; ++j)
                {
                    ctor_args [j] = CreateArg(vm, attr.ctor_args [j]);
                }
                var named_args = new List <object> (attr.named_args.Length);
                for (int j = 0; j < attr.named_args.Length; ++j)
                {
                    CattrNamedArgInfo arg = attr.named_args [j];
                    CustomAttributeTypedArgumentMirror val;
                    CustomAttributeNamedArgumentMirror?named_arg = null;

                    val = CreateArg(vm, arg.value);

                    TypeMirror t = ctor.DeclaringType;
                    while (named_arg == null && t != null)
                    {
                        if (arg.is_property)
                        {
                            foreach (var prop in t.GetProperties())
                            {
                                if (prop.Id == arg.id)
                                {
                                    named_arg = new CustomAttributeNamedArgumentMirror(prop, null, val);
                                }
                            }
                        }
                        else if (vm.Version.AtLeast(2, 12))                              // we don't have the field ID before 2.12
                        {
                            foreach (var field in t.GetFields())
                            {
                                if (field.Id == arg.id)
                                {
                                    named_arg = new CustomAttributeNamedArgumentMirror(null, field, val);
                                }
                            }
                        }
                        t = t.BaseType;
                    }

                    if (named_arg.HasValue)
                    {
                        named_args.Add(named_arg.Value);
                    }
                }
                res [i] = new CustomAttributeDataMirror(ctor, ctor_args, named_args.ToArray());
            }

            return(res);
        }
All Usage Examples Of Mono.Debugger.Soft.TypeMirror::GetFields