예제 #1
0
        public virtual void TransformMethodToExtension(TypeDefinition targetType, MethodDefinition method)
        {
            if (method.IsStatic)
            {
                return;
            }

            method.IsStatic     = true;
            method.IsVirtual    = false;
            method.IsNewSlot    = false;
            method.IsReuseSlot  = true;
            method.HasThis      = false;
            method.ExplicitThis = false;

            method.AddAttribute(method.Module.ImportReference(c_ExtensionAttribute));

            method.Parameters.Insert(0, new ParameterDefinition("self", ParameterAttributes.None, targetType));
        }