Esempio n. 1
0
        /// <summary> Creates new method signature with brand new type parameters. Since you can't have declared multiple methods with the same type parameters, you should use Clone to create similar method signatures. </summary>
        public MethodSignature Clone()
        {
            if (this.TypeParameters.Length == 0)
            {
                return(this);
            }
            var newTypeParams = TypeParameters.EagerSelect(tp => new GenericParameter(Guid.NewGuid(), tp.Name));
            var resultType    = ResultType.SubstituteGenerics(TypeParameters, newTypeParams.EagerSelect(TypeReference.GenericParameter));
            var @params       = Params.EagerSelect(p => p.SubstituteGenerics(TypeParameters, newTypeParams.EagerSelect(TypeReference.GenericParameter)));

            return(this.With(@params: @params, resultType: resultType, typeParameters: newTypeParams));
        }