System.Xml.Serialization.MethodBuilderInfo.Validate C# (CSharp) Method

Validate() public method

public Validate ( Type returnType, Type parameterTypes, MethodAttributes attributes ) : void
returnType System.Type
parameterTypes System.Type
attributes MethodAttributes
return void
        public void Validate(Type returnType, Type[] parameterTypes, MethodAttributes attributes)
        {
#if DEBUG
            Debug.Assert(this.MethodBuilder.ReturnType == returnType);
            Debug.Assert(this.MethodBuilder.Attributes == attributes);
            Debug.Assert(this.ParameterTypes.Length == parameterTypes.Length);
            for (int i = 0; i < parameterTypes.Length; ++i) {
                Debug.Assert(this.ParameterTypes[i] == parameterTypes[i]);
            }
#endif
        }
    }

Usage Example

        internal void BeginMethod(Type returnType, MethodBuilderInfo methodBuilderInfo, Type[] argTypes, string[] argNames, MethodAttributes methodAttributes) {
#if DEBUG
            methodBuilderInfo.Validate(returnType, argTypes, methodAttributes);
#endif
            this.methodBuilder = methodBuilderInfo.MethodBuilder;
            this.ilGen = methodBuilder.GetILGenerator();
            InitILGeneration(argTypes, argNames, (methodBuilder.Attributes & MethodAttributes.Static) == MethodAttributes.Static);
        }