• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IOutputFormatter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IOutputFormatter的典型用法代码示例。如果您正苦于以下问题:C# IOutputFormatter类的具体用法?C# IOutputFormatter怎么用?C# IOutputFormatter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IOutputFormatter类属于命名空间,在下文中一共展示了IOutputFormatter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: RenderSelection

        /// <summary>
        /// Renders just the selection set completely.
        /// </summary>
        ///
        /// <param name="outputFormatter">
        /// The output formatter.
        /// </param>
        ///
        /// <returns>
        /// A string of HTML.
        /// </returns>

        public string RenderSelection(IOutputFormatter outputFormatter)
        {
            StringWriter writer = new StringWriter();
            RenderSelection(outputFormatter, writer);

            return writer.ToString();
        }
开发者ID:emrahoner,项目名称:CsQuery,代码行数:19,代码来源:Render.cs


示例2: MixinReferenceReportGenerator

        public MixinReferenceReportGenerator(
        InvolvedType involvedType, 
        IIdentifierGenerator<Assembly> assemblyIdentifierGenerator, 
        IIdentifierGenerator<Type> involvedTypeIdentifierGenerator, 
        IIdentifierGenerator<Type> interfaceIdentifierGenerator, 
        IIdentifierGenerator<Type> attributeIdentifierGenerator, 
        IRemotionReflector remotionReflector, 
        IOutputFormatter outputFormatter
        )
        {
            ArgumentUtility.CheckNotNull ("involvedType", involvedType);
              ArgumentUtility.CheckNotNull ("assemblyIdentifierGenerator", assemblyIdentifierGenerator);
              ArgumentUtility.CheckNotNull ("involvedTypeIdentifierGenerator", involvedTypeIdentifierGenerator);
              ArgumentUtility.CheckNotNull ("interfaceIdentifierGenerator", interfaceIdentifierGenerator);
              ArgumentUtility.CheckNotNull ("attributeIdentifierGenerator", attributeIdentifierGenerator);
              ArgumentUtility.CheckNotNull ("remotionReflector", remotionReflector);
              ArgumentUtility.CheckNotNull ("outputFormatter", outputFormatter);

              _involvedType = involvedType;
              _assemblyIdentifierGenerator = assemblyIdentifierGenerator;
              _involvedTypeIdentifierGenerator = involvedTypeIdentifierGenerator;
              _interfaceIdentifierGenerator = interfaceIdentifierGenerator;
              _attributeIdentifierGenerator = attributeIdentifierGenerator;
              _remotionReflector = remotionReflector;
              _outputFormatter = outputFormatter;
        }
开发者ID:re-motion,项目名称:Mixins-XRef,代码行数:26,代码来源:MixinReferenceReportGenerator.cs


示例3: JsonResult

        /// <summary>
        /// Creates a new <see cref="JsonResult"/> with the given <paramref name="value"/>.
        /// </summary>
        /// <param name="value">The value to format as JSON.</param>
        /// <param name="formatter">The formatter to use, or <c>null</c> to choose a formatter dynamically.</param>
        public JsonResult(object value, IOutputFormatter formatter)
        {
            Value = value;
            Formatter = formatter;

            ContentTypes = new List<MediaTypeHeaderValue>();
        }
开发者ID:RehanSaeed,项目名称:Mvc,代码行数:12,代码来源:JsonResult.cs


示例4: InvolvedTypeReportGenerator

        public InvolvedTypeReportGenerator(
      InvolvedType[] involvedTypes,
      IIdentifierGenerator<Assembly> assemblyIdentifierGenerator,
      IIdentifierGenerator<Type> involvedTypeIdentifierGenerator,
      IIdentifierGenerator<MemberInfo> memberIdentifierGenerator,
      IIdentifierGenerator<Type> interfaceIdentifierGenerator,
      IIdentifierGenerator<Type> attributeIdentifierGenerator,
      IRemotionReflector remotionReflector,
      IOutputFormatter outputFormatter)
        {
            ArgumentUtility.CheckNotNull ("involvedTypes", involvedTypes);
              ArgumentUtility.CheckNotNull ("assemblyIdentifierGenerator", assemblyIdentifierGenerator);
              ArgumentUtility.CheckNotNull ("involvedTypeIdentifierGenerator", involvedTypeIdentifierGenerator);
              ArgumentUtility.CheckNotNull ("memberIdentifierGenerator", memberIdentifierGenerator);
              ArgumentUtility.CheckNotNull ("interfaceIdentifierGenerator", interfaceIdentifierGenerator);
              ArgumentUtility.CheckNotNull ("attributeIdentifierGenerator", attributeIdentifierGenerator);
              ArgumentUtility.CheckNotNull ("remotionReflector", remotionReflector);
              ArgumentUtility.CheckNotNull ("outputFormatter", outputFormatter);

              _involvedTypes = involvedTypes;
              _assemblyIdentifierGenerator = assemblyIdentifierGenerator;
              _involvedTypeIdentifierGenerator = involvedTypeIdentifierGenerator;
              _memberIdentifierGenerator = memberIdentifierGenerator;
              _interfaceIdentifierGenerator = interfaceIdentifierGenerator;
              _attributeIdentifierGenerator = attributeIdentifierGenerator;
              _remotionReflector = remotionReflector;
              _outputFormatter = outputFormatter;
        }
开发者ID:re-motion,项目名称:Mixins-XRef,代码行数:28,代码来源:InvolvedTypeReportGenerator.cs


示例5: TargetCallDependenciesReportGenerator

 public TargetCallDependenciesReportGenerator(ReflectedObject mixinDefinition, IIdentifierGenerator<Assembly> assemblyIdentifierGenerator, IRemotionReflector remotionReflector, IOutputFormatter outputFormatter)
 {
     _mixinDefinition = mixinDefinition;
       _assemblyIdentifierGenerator = assemblyIdentifierGenerator;
       _remotionReflector = remotionReflector;
       _outputFormatter = outputFormatter;
 }
开发者ID:re-motion,项目名称:Mixins-XRef,代码行数:7,代码来源:TargetCallDependenciesReportGenerator.cs


示例6: FormatterSelected

 public static void FormatterSelected(
     this ILogger logger,
     IOutputFormatter outputFormatter,
     OutputFormatterWriteContext context)
 {
     var contentType = Convert.ToString(context.ContentType);
     _formatterSelected(logger, outputFormatter, contentType, null);
 }
开发者ID:phinq19,项目名称:git_example,代码行数:8,代码来源:ObjectResultExecutorLoggerExtensions.cs


示例7: DecoratedOutputFormatter

 public DecoratedOutputFormatter(IOutputFormatter formatter, IAstVisitor visitor)
 {
     if (formatter == null)
         throw new ArgumentNullException(nameof(formatter));
     if (visitor == null)
         throw new ArgumentNullException(nameof(visitor));
     _formatter = formatter;
     _visitor = visitor;
 }
开发者ID:JerreS,项目名称:AbstractCode,代码行数:9,代码来源:DecoratedOutputFormatter.cs


示例8: CodeCommentDecorator

 /// <summary>
 /// Initializes a new instance of <see cref="CodeCommentDecorator"/> with the provided
 /// <paramref name="outputFormatter"/>.
 /// </summary>
 /// 
 /// <param name="outputFormatter">
 /// An <see cref="IOutputFormatter"/> implementation to which code documentation comments will be written.
 /// </param>
 public CodeCommentDecorator(IOutputFormatter outputFormatter)
 {
     if (outputFormatter == null)
     {
         Debug.Assert(false, "outputFormatter is null");
         throw new ArgumentNullException("outputFormatter");
     }
     _formatter = outputFormatter;
 }
开发者ID:olivierdagenais,项目名称:testoriented,代码行数:17,代码来源:CodeCommentDecorator.cs


示例9: CreateInterfaceReportGenerator

 public static InterfaceReportGenerator CreateInterfaceReportGenerator(IRemotionReflector remotionReflector, IOutputFormatter outputFormatter, params InvolvedType[] types)
 {
     return new InterfaceReportGenerator (types,
                                    new IdentifierGenerator<Assembly> (),
                                    new IdentifierGenerator<Type> (),
                                    new IdentifierGenerator<MemberInfo> (),
                                    new IdentifierGenerator<Type> (),
                                    remotionReflector,
                                    outputFormatter);
 }
开发者ID:re-motion,项目名称:Mixins-XRef,代码行数:10,代码来源:ReportBuilder.cs


示例10: CSharpOutputVisitor

		public CSharpOutputVisitor (IOutputFormatter formatter, CSharpFormattingOptions formattingPolicy)
		{
			if (formatter == null) {
				throw new ArgumentNullException ("formatter");
			}
			if (formattingPolicy == null) {
				throw new ArgumentNullException ("formattingPolicy");
			}
			this.formatter = formatter;
			this.policy = formattingPolicy;
		}
开发者ID:x-strong,项目名称:ILSpy,代码行数:11,代码来源:CSharpOutputVisitor.cs


示例11: Configuration

 public Configuration(IEnumerable<IFieldHarvester> fieldHarvesters, 
   IEnumerable<IValueConverter> valueConverters, 
   string indentIncrement, 
   IOutputFormatter outputFormatter,
   CultureInfo culture)
 {
   this.valueConverters = valueConverters.ToList();
   this.fieldHarvesters = fieldHarvesters.ToList();
   IndentIncrement = indentIncrement;
   OutputFormatter = outputFormatter;
   Culture = culture;
 }
开发者ID:cyanite,项目名称:StatePrinter,代码行数:12,代码来源:Configuration.cs


示例12: AdditionalDependencyReportGenerator

        public AdditionalDependencyReportGenerator(
        ReflectedObject explicitDependencies,
        IIdentifierGenerator<Type> involvedTypeIdentifierGenerator,
        IOutputFormatter outputFormatter)
        {
            ArgumentUtility.CheckNotNull ("explicitDependencies", explicitDependencies);
              ArgumentUtility.CheckNotNull ("involvedTypeIdentifierGenerator", involvedTypeIdentifierGenerator);
              ArgumentUtility.CheckNotNull ("outputFormatter", outputFormatter);

              _explicitDependencies = explicitDependencies;
              _involvedTypeIdentifierGenerator = involvedTypeIdentifierGenerator;
              _outputFormatter = outputFormatter;
        }
开发者ID:re-motion,项目名称:Mixins-XRef,代码行数:13,代码来源:AdditionalDependencyReportGenerator.cs


示例13: CreateInvolvedTypeReportGenerator

        public static InvolvedTypeReportGenerator CreateInvolvedTypeReportGenerator(IRemotionReflector remotionReflector, IOutputFormatter outputFormatter, params InvolvedType[] involvedTypes)
        {
            var assemblyIdentifierGenerator = StubFactory.CreateIdentifierGeneratorStub (new Assembly[0]);
              var involvedTypeIdentifierGenerator = StubFactory.CreateIdentifierGeneratorStub (involvedTypes.Select (t => t.Type));

              return new InvolvedTypeReportGenerator (involvedTypes,
                                              assemblyIdentifierGenerator,
                                              involvedTypeIdentifierGenerator,
                                              new IdentifierGenerator<MemberInfo> (),
                                              new IdentifierGenerator<Type> (),
                                              new IdentifierGenerator<Type> (),
                                              remotionReflector,
                                              outputFormatter);
        }
开发者ID:re-motion,项目名称:Mixins-XRef,代码行数:14,代码来源:ReportBuilder.cs


示例14: FullReportGenerator

        public FullReportGenerator(
        InvolvedType[] involvedTypes,
        ErrorAggregator<Exception> configurationErrors,
        ErrorAggregator<Exception> validationErrors,
        IRemotionReflector remotionReflector,
        IOutputFormatter outputFormatter)
        {
            ArgumentUtility.CheckNotNull ("_involvedTypes", involvedTypes);
              ArgumentUtility.CheckNotNull ("configurationErrors", configurationErrors);
              ArgumentUtility.CheckNotNull ("validationErrors", validationErrors);
              ArgumentUtility.CheckNotNull ("remotionReflector", remotionReflector);
              ArgumentUtility.CheckNotNull ("outputFormatter", outputFormatter);

              _involvedTypes = involvedTypes;
              _configurationErrors = configurationErrors;
              _validationErrors = validationErrors;
              _remotionReflector = remotionReflector;
              _outputFormatter = outputFormatter;
        }
开发者ID:re-motion,项目名称:Mixins-XRef,代码行数:19,代码来源:FullReportGenerator.cs


示例15: MemberReportGenerator

        public MemberReportGenerator(
      Type type,
      InvolvedType involvedTypeOrNull,
      IIdentifierGenerator<Type> involvedTypeIdentifierGeneratorOrNull,
      IIdentifierGenerator<MemberInfo> memberIdentifierGeneratorOrNull,
      IOutputFormatter outputFormatter)
        {
            ArgumentUtility.CheckNotNull ("type", type);
              // may be null
              // ArgumentUtility.CheckNotNull ("involvedTypeOrNull", involvedTypeOrNull);
              // ArgumentUtility.CheckNotNull ("involvedTypeIdentifierGeneratorOrNull", involvedTypeIdentifierGeneratorOrNull);
              // ArgumentUtility.CheckNotNull ("memberIdentifierGeneratorOrNull", memberIdentifierGeneratorOrNull);
              ArgumentUtility.CheckNotNull ("outputFormatter", outputFormatter);

              _type = type;
              _involvedType = involvedTypeOrNull;
              _involvedTypeIdentifierGenerator = involvedTypeIdentifierGeneratorOrNull;
              _memberIdentifierGenerator = memberIdentifierGeneratorOrNull;
              _outputFormatter = outputFormatter;
              _memberSignatureUtility = new MemberSignatureUtility (outputFormatter);
        }
开发者ID:re-motion,项目名称:Mixins-XRef,代码行数:21,代码来源:MemberReportGenerator.cs


示例16: CreateMockActionContext

        private static ActionContext CreateMockActionContext(
                                                             HttpResponse response = null,
                                                             string requestAcceptHeader = "application/*",
                                                             string requestContentType = "application/json",
                                                             string requestAcceptCharsetHeader = "",
                                                             bool respectBrowserAcceptHeader = false)
        {
            var formatters = new IOutputFormatter[] { new StringOutputFormatter(), new JsonOutputFormatter() };
            var httpContext = new Mock<HttpContext>();
            if (response != null)
            {
                httpContext.Setup(o => o.Response).Returns(response);
            }

            var content = "{name: 'Person Name', Age: 'not-an-age'}";
            var contentBytes = Encoding.UTF8.GetBytes(content);

            var request = new DefaultHttpContext().Request;
            request.Headers["Accept-Charset"] = requestAcceptCharsetHeader;
            request.Headers["Accept"] = requestAcceptHeader;
            request.ContentType = requestContentType;
            request.Body = new MemoryStream(contentBytes);

            httpContext.Setup(o => o.Request).Returns(request);
            httpContext.Setup(o => o.RequestServices).Returns(GetServiceProvider());
            httpContext.Setup(o => o.RequestServices.GetService(typeof(IOutputFormattersProvider)))
                       .Returns(new TestOutputFormatterProvider(formatters));

            var options = new Mock<IOptions<MvcOptions>>();
            options.SetupGet(o => o.Options)
                       .Returns(new MvcOptions()
                       {
                           RespectBrowserAcceptHeader = respectBrowserAcceptHeader
                       });
            httpContext.Setup(o => o.RequestServices.GetService(typeof(IOptions<MvcOptions>)))
                       .Returns(options.Object);

            return new ActionContext(httpContext.Object, new RouteData(), new ActionDescriptor());
        }
开发者ID:AndersBillLinden,项目名称:Mvc,代码行数:39,代码来源:HttpNotFoundObjectResultTest.cs


示例17: ObjectResult_PerformsContentNegotiation_OnAllMediaRangeAcceptHeaderMediaType

        public async Task ObjectResult_PerformsContentNegotiation_OnAllMediaRangeAcceptHeaderMediaType(
            string acceptHeader,
            string expectedResponseContentType)
        {
            // Arrange
            var objectResult = new ObjectResult(new Person() { Name = "John" });
            var outputFormatters = new IOutputFormatter[] {
                new HttpNoContentOutputFormatter(),
                new StringOutputFormatter(),
                new JsonOutputFormatter(),
                new XmlDataContractSerializerOutputFormatter()
            };
            var response = GetMockHttpResponse();

            var actionContext = CreateMockActionContext(
                                    outputFormatters,
                                    response.Object,
                                    requestAcceptHeader: acceptHeader,
                                    respectBrowserAcceptHeader: true);

            // Act
            await objectResult.ExecuteResultAsync(actionContext);

            // Assert
            response.VerifySet(resp => resp.ContentType = expectedResponseContentType);
        }
开发者ID:ryanbrandenburg,项目名称:Mvc,代码行数:26,代码来源:ObjectResultTests.cs


示例18: MemberSignatureUtility

        public MemberSignatureUtility(IOutputFormatter outputFormatter)
        {
            ArgumentUtility.CheckNotNull ("outputFormatter", outputFormatter);

              _outputFormatter = outputFormatter;
        }
开发者ID:re-motion,项目名称:Mixins-XRef,代码行数:6,代码来源:MemberSignatureUtility.cs


示例19: ObjectResult_WithStream_SetsExplicitContentType

        public async Task ObjectResult_WithStream_SetsExplicitContentType()
        {
            // Arrange
            var objectResult = new ObjectResult(new MemoryStream(Encoding.UTF8.GetBytes("Name=James")));
            objectResult.ContentTypes.Add(new MediaTypeHeaderValue("application/foo"));
            var outputFormatters = new IOutputFormatter[]
            {
                new StreamOutputFormatter(),
                new JsonOutputFormatter()
            };
            var response = new Mock<HttpResponse>();
            var responseStream = new MemoryStream();
            response.SetupGet(r => r.Body).Returns(responseStream);
            var expectedData = "Name=James";

            var actionContext = CreateMockActionContext(
                                    outputFormatters,
                                    response.Object,
                                    requestAcceptHeader: "application/json",
                                    requestContentType: null);

            // Act
            await objectResult.ExecuteResultAsync(actionContext);

            // Assert
            response.VerifySet(r => r.ContentType = "application/foo");
            responseStream.Position = 0;
            var actual = new StreamReader(responseStream).ReadToEnd();
            Assert.Equal(expectedData, actual);
        }
开发者ID:ryanbrandenburg,项目名称:Mvc,代码行数:30,代码来源:ObjectResultTests.cs


示例20: CreateMockActionContext

        private static ActionContext CreateMockActionContext(
            HttpResponse response = null,
            string requestAcceptHeader = "application/*",
            string requestContentType = "application/json",
            string requestAcceptCharsetHeader = "",
            bool respectBrowserAcceptHeader = false)
        {
            var formatters = new IOutputFormatter[] { new StringOutputFormatter(), new JsonOutputFormatter() };

            return CreateMockActionContext(
                                            formatters,
                                            response: response,
                                            requestAcceptHeader: requestAcceptHeader,
                                            requestContentType: requestContentType,
                                            requestAcceptCharsetHeader: requestAcceptCharsetHeader,
                                            respectBrowserAcceptHeader: respectBrowserAcceptHeader);
        }
开发者ID:ryanbrandenburg,项目名称:Mvc,代码行数:17,代码来源:ObjectResultTests.cs



注:本文中的IOutputFormatter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IOutputStream类代码示例发布时间:2022-05-24
下一篇:
C# IOutputArray类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap