Mono.CSharp.MethodSpec.GetMetaInfo C# (CSharp) Method

GetMetaInfo() public method

public GetMetaInfo ( ) : MethodBase
return MethodBase
        public MethodBase GetMetaInfo()
        {
            //
            // inflatedMetaInfo is extra field needed for cases where we
            // inflate method but another nested type can later inflate
            // again (the cache would be build with inflated metaInfo) and
            // TypeBuilder can work with method definitions only
            //
            if (inflatedMetaInfo == null) {
                if ((state & StateFlags.PendingMetaInflate) != 0) {
                    var dt_meta = DeclaringType.GetMetaInfo ();

                    if (DeclaringType.IsTypeBuilder) {
                        if (IsConstructor)
                            inflatedMetaInfo = TypeBuilder.GetConstructor (dt_meta, (ConstructorInfo) metaInfo);
                        else
                            inflatedMetaInfo = TypeBuilder.GetMethod (dt_meta, (MethodInfo) metaInfo);
                    } else {
            #if STATIC
                        // it should not be reached
                        throw new NotImplementedException ();
            #else
                        inflatedMetaInfo = MethodInfo.GetMethodFromHandle (metaInfo.MethodHandle, dt_meta.TypeHandle);
            #endif
                    }

                    state &= ~StateFlags.PendingMetaInflate;
                } else {
                    inflatedMetaInfo = metaInfo;
                }
            }

            if ((state & StateFlags.PendingMakeMethod) != 0) {
                var sre_targs = new MetaType[targs.Length];
                for (int i = 0; i < sre_targs.Length; ++i)
                    sre_targs[i] = targs[i].GetMetaInfo ();

                inflatedMetaInfo = ((MethodInfo) inflatedMetaInfo).MakeGenericMethod (sre_targs);
                state &= ~StateFlags.PendingMakeMethod;
            }

            return inflatedMetaInfo;
        }

Usage Example

Example #1
0
		public override void ApplyAttributeBuilder (Attribute a, MethodSpec ctor, byte[] cdata, PredefinedAttributes pa)
		{
#if false
			if (a.Type == pa.MarshalAs) {
				UnmanagedMarshal marshal = a.GetMarshal (this);
				if (marshal != null) {
					builder.SetMarshal (marshal);
				}
				return;
			}
#endif
			if (a.HasSecurityAttribute) {
				a.Error_InvalidSecurityParent ();
				return;
			}

			if (a.Type == pa.Dynamic) {
				a.Error_MisusedDynamicAttribute ();
				return;
			}

			builder.SetCustomAttribute ((ConstructorInfo) ctor.GetMetaInfo (), cdata);
		}
All Usage Examples Of Mono.CSharp.MethodSpec::GetMetaInfo