internal HttpMessageHandlerFactoryElement GenerateConfigurationElement() { if (this.handlerFunc != null) { throw FxTrace.Exception.AsError(new InvalidOperationException(SR.GetString(SR.HttpMessageHandlerFactoryWithFuncCannotGenerateConfig, typeof(HttpMessageHandlerFactory).Name, typeof(Func <IEnumerable <DelegatingHandler> >).Name))); } Type thisType = this.GetType(); if (thisType != typeof(HttpMessageHandlerFactory)) { return(new HttpMessageHandlerFactoryElement { Type = thisType.AssemblyQualifiedName }); } else { if (this.httpMessageHandlers != null) { DelegatingHandlerElementCollection handlerCollection = new DelegatingHandlerElementCollection(); for (int i = 0; i < this.httpMessageHandlers.Length; i++) { handlerCollection.Add(new DelegatingHandlerElement(this.httpMessageHandlers[i])); } return(new HttpMessageHandlerFactoryElement { Handlers = handlerCollection }); } } return(null); }
internal HttpMessageHandlerFactoryElement GenerateConfigurationElement() { if (this.handlerFunc != null) { throw FxTrace.Exception.AsError(new InvalidOperationException(SR.GetString(SR.HttpMessageHandlerFactoryWithFuncCannotGenerateConfig, typeof(HttpMessageHandlerFactory).Name, typeof(Func<IEnumerable<DelegatingHandler>>).Name))); } Type thisType = this.GetType(); if (thisType != typeof(HttpMessageHandlerFactory)) { return new HttpMessageHandlerFactoryElement { Type = thisType.AssemblyQualifiedName }; } else { if (this.httpMessageHandlers != null) { DelegatingHandlerElementCollection handlerCollection = new DelegatingHandlerElementCollection(); for (int i = 0; i < this.httpMessageHandlers.Length; i++) { handlerCollection.Add(new DelegatingHandlerElement(this.httpMessageHandlers[i])); } return new HttpMessageHandlerFactoryElement { Handlers = handlerCollection }; } } return null; }