Пример #1
0
 private MethodReference ListConstructorRefFor(TypeReference typeReference) =>
 new MethodReference(".ctor", base.Import(typeof(void)), MethodEmitterBase.TypeReferenceFor(typeReference))
 {
     HasThis    = true,
     Parameters = { base.ParamDef("count", typeof(int)) }
 };
Пример #2
0
        private MethodReference DeserializeMethodRefFor(TypeReference typeReference)
        {
            MethodReference reference = new MethodReference(this.DeserializeMethodName, base.Import(typeof(void)), MethodEmitterBase.TypeReferenceFor(typeReference))
            {
                HasThis = true
            };

            reference.Parameters.Add(new ParameterDefinition("depth", ParameterAttributes.None, base.Import(typeof(int))));
            return(reference);
        }
Пример #3
0
        private MethodReference AddMethodRefFor(TypeReference typeReference)
        {
            GenericParameter parameterType = ((GenericInstanceType)typeReference).ElementType.GenericParameters[0];
            MethodReference  method        = new MethodReference("Add", base.Import(typeof(void)), MethodEmitterBase.TypeReferenceFor(typeReference))
            {
                Parameters = { new ParameterDefinition("item", ParameterAttributes.None, parameterType) },
                HasThis    = true
            };

            return(base.Module.ImportReference(method));
        }