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

C# IO.TextWriter类代码示例

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

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



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

示例1: WriteClass

        public void WriteClass(IJsonClassGeneratorConfig config, TextWriter sw, JsonType type)
        {
            var visibility = config.InternalVisibility ? "Friend" : "Public";

            if (config.UseNestedClasses)
            {
                sw.WriteLine("    {0} Partial Class {1}", visibility, config.MainClass);
                if (!type.IsRoot)
                {
                    if (ShouldApplyNoRenamingAttribute(config)) sw.WriteLine("        " + NoRenameAttribute);
                    if (ShouldApplyNoPruneAttribute(config)) sw.WriteLine("        " + NoPruneAttribute);
                    sw.WriteLine("        {0} Class {1}", visibility, type.AssignedName);
                }
            }
            else
            {
                if (ShouldApplyNoRenamingAttribute(config)) sw.WriteLine("    " + NoRenameAttribute);
                if (ShouldApplyNoPruneAttribute(config)) sw.WriteLine("    " + NoPruneAttribute);
                sw.WriteLine("    {0} Class {1}", visibility, type.AssignedName);
            }

            var prefix = config.UseNestedClasses && !type.IsRoot ? "            " : "        ";

            WriteClassMembers(config, sw, type, prefix);

            if (config.UseNestedClasses && !type.IsRoot)
                sw.WriteLine("        End Class");

            sw.WriteLine("    End Class");
            sw.WriteLine();
        }
开发者ID:prasanjeevi,项目名称:AppInt,代码行数:31,代码来源:VisualBasicCodeWriter.cs


示例2: HtmlDecode

        public virtual void HtmlDecode(string value, TextWriter output)
        {
            if (output == null)
                throw new ArgumentNullException ("output");

            output.Write (HtmlDecode (value));
        }
开发者ID:UStack,项目名称:UWeb,代码行数:7,代码来源:HttpEncoder.cs


示例3: InitBranch

 public InitBranch(TextWriter stdout, Globals globals, Help helper, AuthorsFile authors)
 {
     _stdout = stdout;
     _globals = globals;
     _helper = helper;
     _authors = authors;
 }
开发者ID:RomanKruglyakov,项目名称:git-tfs,代码行数:7,代码来源:InitBranch.cs


示例4: UpdateOutputLogCommand

 private UpdateOutputLogCommand(IStorageBlockBlob outputBlob, Func<string, CancellationToken, Task> uploadCommand)
 {
     _outputBlob = outputBlob;
     _innerWriter = new StringWriter(CultureInfo.InvariantCulture);
     _synchronizedWriter = TextWriter.Synchronized(_innerWriter);
     _uploadCommand = uploadCommand;
 }
开发者ID:jonkelling,项目名称:azure-webjobs-sdk,代码行数:7,代码来源:UpdateOutputLogCommand.cs


示例5: toXML

 public override void toXML(TextWriter tw)
 {
     tw.WriteLine("<" + Constants.BINC45MODELSELECTION_ELEMENT + " " +
     Constants.MIN_NO_OBJ_ATTRIBUTE + "=\"" + this.m_minNoObj + "\"   " +
     " xmlns=\"urn:mites-schema\">\n");
     tw.WriteLine("</" + Constants.BINC45MODELSELECTION_ELEMENT + ">");           
 }
开发者ID:intille,项目名称:mitessoftware,代码行数:7,代码来源:BinC45ModelSelection.cs


示例6: Create

        public static ITriggerBindingProvider Create(INameResolver nameResolver,
            IStorageAccountProvider storageAccountProvider,
            IExtensionTypeLocator extensionTypeLocator,
            IHostIdProvider hostIdProvider,
            IQueueConfiguration queueConfiguration,
            IBackgroundExceptionDispatcher backgroundExceptionDispatcher,
            IContextSetter<IMessageEnqueuedWatcher> messageEnqueuedWatcherSetter,
            IContextSetter<IBlobWrittenWatcher> blobWrittenWatcherSetter,
            ISharedContextProvider sharedContextProvider,
            IExtensionRegistry extensions,
            TextWriter log)
        {
            List<ITriggerBindingProvider> innerProviders = new List<ITriggerBindingProvider>();
            innerProviders.Add(new QueueTriggerAttributeBindingProvider(nameResolver, storageAccountProvider,
                queueConfiguration, backgroundExceptionDispatcher, messageEnqueuedWatcherSetter,
                sharedContextProvider, log));
            innerProviders.Add(new BlobTriggerAttributeBindingProvider(nameResolver, storageAccountProvider,
                extensionTypeLocator, hostIdProvider, queueConfiguration, backgroundExceptionDispatcher,
                blobWrittenWatcherSetter, messageEnqueuedWatcherSetter, sharedContextProvider, log));

            // add any registered extension binding providers
            foreach (ITriggerBindingProvider provider in extensions.GetExtensions(typeof(ITriggerBindingProvider)))
            {
                innerProviders.Add(provider);
            }

            return new CompositeTriggerBindingProvider(innerProviders);
        }
开发者ID:Bjakes1950,项目名称:azure-webjobs-sdk,代码行数:28,代码来源:DefaultTriggerBindingProvider.cs


示例7: Write

        public static void Write(TextWriter writer, IEnumerable<Dictionary<string, string>> records)
        {
            if (records == null) return; //AOT

            var allKeys = new HashSet<string>();
            var cachedRecords = new List<IDictionary<string, string>>();

            foreach (var record in records)
            {
                foreach (var key in record.Keys)
                {
                    if (!allKeys.Contains(key))
                    {
                        allKeys.Add(key);
                    }
                }
                cachedRecords.Add(record);
            }

            var headers = allKeys.OrderBy(key => key).ToList();
            if (!CsvConfig<Dictionary<string, string>>.OmitHeaders)
            {
                WriteRow(writer, headers);
            }
            foreach (var cachedRecord in cachedRecords)
            {
                var fullRecord = headers.ConvertAll(header => 
                    cachedRecord.ContainsKey(header) ? cachedRecord[header] : null);
                WriteRow(writer, fullRecord);
            }
        }
开发者ID:Gunner92,项目名称:Xamarin-Forms-Labs,代码行数:31,代码来源:CsvWriter.cs


示例8: Metas

 public void Metas(TextWriter Output)
 {
     foreach (var meta in resourceManager.GetRegisteredMetas())
     {
         Output.WriteLine(meta.GetTag());
     }
 }
开发者ID:AgileEAP,项目名称:AgileEAP-BPM,代码行数:7,代码来源:ResourceWriter.cs


示例9: Merge

 public static void Merge(FileDescriptorSet files, string path, TextWriter stderr, params string[] args)
 {
     if (stderr == null) throw new ArgumentNullException("stderr");
     if (files == null) throw new ArgumentNullException("files");
     if (string.IsNullOrEmpty(path)) throw new ArgumentNullException("path");
     
     bool deletePath = false;
     if(!IsValidBinary(path))
     { // try to use protoc
         path = CompileDescriptor(path, stderr, args);
         deletePath = true;
     }
     try
     {
         using (FileStream stream = File.OpenRead(path))
         {
             Serializer.Merge(stream, files);
         }
     }
     finally
     {
         if(deletePath)
         {
             File.Delete(path);
         }
     }
 }
开发者ID:praveenv4k,项目名称:indriya,代码行数:27,代码来源:InputFileLoader.cs


示例10: HeadLinks

 public void HeadLinks(TextWriter Output)
 {
     foreach (var link in resourceManager.GetRegisteredLinks())
     {
         Output.WriteLine(link.GetTag());
     }
 }
开发者ID:AgileEAP,项目名称:AgileEAP-BPM,代码行数:7,代码来源:ResourceWriter.cs


示例11: ResXResourceWriter

		public ResXResourceWriter (TextWriter textWriter)
		{
			if (textWriter == null)
				throw new ArgumentNullException ("textWriter");

			this.textwriter = textWriter;
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:7,代码来源:ResXResourceWriter.cs


示例12: AddConversationsToDatabaseAsync

      private async static Task AddConversationsToDatabaseAsync(Provider provider, Category category, 
         IEnumerable<Conversation> newConversations, TextWriter logger)
      {
         int conversationsAddedToDatabase = 0;
         int conversationsUpdatedInDatabase = 0;

         foreach (var newConversation in newConversations)
         {
            var existingCon = db.Conversations
              .Where(c => c.CategoryID == category.CategoryID &&   
                          c.Url == newConversation.Url)            
               .SingleOrDefault();

            if (existingCon != null && existingCon.LastUpdated < newConversation.LastUpdated)
            {
               existingCon.LastUpdated = newConversation.LastUpdated;
               existingCon.DbUpdated = DateTimeOffset.UtcNow;
               existingCon.Body = newConversation.Body;
               db.Entry(existingCon).State = EntityState.Modified;
               conversationsUpdatedInDatabase++;
            }
            else if (existingCon == null)
            {
               newConversation.DbUpdated = DateTimeOffset.UtcNow;
               db.Conversations.Add(newConversation);
               conversationsAddedToDatabase++;
            }
         }
         logger.WriteLine("Added {0} new conversations, updated {1} conversations", 
            conversationsAddedToDatabase, conversationsUpdatedInDatabase);
         await db.SaveChangesAsync();
      }
开发者ID:modulexcite,项目名称:Altostratus,代码行数:32,代码来源:Functions.cs


示例13: Render_Template_HTML

        /// <summary> Renders the HTML for this element </summary>
        /// <param name="Output"> Textwriter to write the HTML for this element </param>
        /// <param name="Bib"> Object to populate this element from </param>
        /// <param name="Skin_Code"> Code for the current skin </param>
        /// <param name="isMozilla"> Flag indicates if the current browse is Mozilla Firefox (different css choices for some elements)</param>
        /// <param name="popup_form_builder"> Builder for any related popup forms for this element </param>
        /// <param name="Current_User"> Current user, who's rights may impact the way an element is rendered </param>
        /// <param name="CurrentLanguage"> Current user-interface language </param>
        /// <param name="Translator"> Language support object which handles simple translational duties </param>
        /// <param name="Base_URL"> Base URL for the current request </param>
        /// <remarks> This simple element does not append any popup form to the popup_form_builder</remarks>
        public override void Render_Template_HTML(TextWriter Output, SobekCM_Item Bib, string Skin_Code, bool isMozilla, StringBuilder popup_form_builder, User_Object Current_User, Web_Language_Enum CurrentLanguage, Language_Support_Info Translator, string Base_URL )
        {
            // Check that an acronym exists
            if (Acronym.Length == 0)
            {
                const string defaultAcronym = "Enter any spatial coverage information which relates to this material.";
                switch (CurrentLanguage)
                {
                    case Web_Language_Enum.English:
                        Acronym = defaultAcronym;
                        break;

                    case Web_Language_Enum.Spanish:
                        Acronym = defaultAcronym;
                        break;

                    case Web_Language_Enum.French:
                        Acronym = defaultAcronym;
                        break;

                    default:
                        Acronym = defaultAcronym;
                        break;
                }
            }

            List<string> allValues = new List<string>();
            if (Bib.Bib_Info.Subjects_Count > 0)
            {
                allValues.AddRange(from thisSubject in Bib.Bib_Info.Subjects where thisSubject.Class_Type == Subject_Info_Type.Hierarchical_Spatial select thisSubject.ToString());
            }
            render_helper(Output, allValues, Skin_Code, Current_User, CurrentLanguage, Translator, Base_URL);
        }
开发者ID:randomyed,项目名称:SobekCM-Web-Application,代码行数:44,代码来源:Spatial_Coverage_Element.cs


示例14: GetCode

        public void GetCode(CodeFormat format, TextWriter writer)
        {
            IOutputProvider output;
            switch (format)
            {
                case CodeFormat.Disassemble:
                    output = OutputFactory.GetDisassembleOutputProvider();
                    break;
                case CodeFormat.ControlFlowDecompile:
                    output = OutputFactory.GetDecompileCFOutputProvider();
                    break;
                case CodeFormat.FullDecompile:
                    output = OutputFactory.GetDecompileFullOutputProvider();
                    break;
                case CodeFormat.FullDecompileAnnotate:
                    output = OutputFactory.GetDecompileFullAnnotateOutputProvider();
                    break;
                case CodeFormat.CodePath:
                    output = OutputFactory.GetCodePathOutputProvider();
                    break;
                case CodeFormat.Variables:
                    output = OutputFactory.GetVariablesOutputProvider();
                    break;
                case CodeFormat.ScruffDecompile:
                    output = OutputFactory.GetScruffDecompileOutputProvider();
                    break;
                case CodeFormat.ScruffHeader:
                    output = OutputFactory.GetScruffHeaderOutputProvider();
                    break;
                default:
                    throw new ArgumentOutOfRangeException("format");
            }

            output.Process(_file, writer);
        }
开发者ID:tjhorner,项目名称:gtaivtools,代码行数:35,代码来源:ScriptFile.cs


示例15: ToGraphic

        public static void ToGraphic(this ByteMatrix matrix, TextWriter output)
        {
            output.WriteLine(matrix.Width.ToString());
            for (int j = 0; j < matrix.Width; j++)
            {
                for (int i = 0; i < matrix.Width; i++)
                {

                    char charToPrint;
                    switch (matrix[i, j])
                    {
                        case 0:
                            charToPrint = s_0Char;
                            break;

                        case 1:
                            charToPrint = s_1Char;
                            break;

                        default:
                            charToPrint = s_EmptyChar;
                            break;

                    }
                    output.Write(charToPrint);
                }
                output.WriteLine();
            }
        }
开发者ID:fengdc,项目名称:QrCode.Net,代码行数:29,代码来源:ByteMatrixToGraphicExtensions.cs


示例16: Render_Template_HTML

        /// <summary> Renders the HTML for this element </summary>
        /// <param name="Output"> Textwriter to write the HTML for this element </param>
        /// <param name="Bib"> Object to populate this element from </param>
        /// <param name="Skin_Code"> Code for the current skin </param>
        /// <param name="isMozilla"> Flag indicates if the current browse is Mozilla Firefox (different css choices for some elements)</param>
        /// <param name="popup_form_builder"> Builder for any related popup forms for this element </param>
        /// <param name="Current_User"> Current user, who's rights may impact the way an element is rendered </param>
        /// <param name="CurrentLanguage"> Current user-interface language </param>
        /// <param name="Translator"> Language support object which handles simple translational duties </param>
        /// <param name="Base_URL"> Base URL for the current request </param>
        /// <remarks> This simple element does not append any popup form to the popup_form_builder</remarks>
        public override void Render_Template_HTML(TextWriter Output, SobekCM_Item Bib, string Skin_Code, bool isMozilla, StringBuilder popup_form_builder, User_Object Current_User, Web_Language_Enum CurrentLanguage, Language_Support_Info Translator, string Base_URL )
        {
            // Check that an acronym exists
            if (Acronym.Length == 0)
            {
                const string defaultAcronym = "Enter the name(s) of the publisher(s) of the larger body of work. If your work is currently unpublished, you may enter your name as the publisher or leave the field blank. If you are adding administrative material (newsletters, handbooks, etc.) on behalf of a department within the university, enter the name of your department as the publisher.";
                switch (CurrentLanguage)
                {
                    case Web_Language_Enum.English:
                        Acronym = defaultAcronym;
                        break;

                    case Web_Language_Enum.Spanish:
                        Acronym = defaultAcronym;
                        break;

                    case Web_Language_Enum.French:
                        Acronym = defaultAcronym;
                        break;

                    default:
                        Acronym = defaultAcronym;
                        break;
                }
            }

            List<string> instanceValues = new List<string>();
            if (Bib.Bib_Info.Publishers_Count > 0)
            {
                instanceValues.AddRange(Bib.Bib_Info.Publishers.Select(thisName => thisName.Name));
            }

            render_helper(Output, instanceValues, Skin_Code, Current_User, CurrentLanguage, Translator, Base_URL);
        }
开发者ID:randomyed,项目名称:SobekCM-Web-Application,代码行数:45,代码来源:Publisher_Element.cs


示例17: DescribeTo

        public virtual void DescribeTo(TextWriter writer)
        {
            Ensure.ArgumentNotNull(writer, "writer");

            if (!this.publisher.IsAlive)
            {
                return;
            }

            writer.Write(this.Publisher.GetType().FullNameToString());

            if (this.Publisher is INamedItem)
            {
                writer.Write(", Name = ");
                writer.Write(((INamedItem)this.Publisher).EventBrokerItemName);
            }
                
            writer.Write(", Event = ");
            writer.Write(this.EventName);
            writer.Write(", matchers = ");
            foreach (IPublicationMatcher publicationMatcher in this.publicationMatchers)
            {
                publicationMatcher.DescribeTo(writer);
                writer.Write(" ");
            }
        }
开发者ID:WenningQiu,项目名称:appccelerate,代码行数:26,代码来源:Publication.cs


示例18: WriteGrades

 public void WriteGrades(TextWriter destination)
 {
     for (int i = grades.Count; i > 0; i--)
     {
         destination.WriteLine(grades[i-1]);
     }
 }
开发者ID:joyzoso,项目名称:C-sharp-and-ASP.NET,代码行数:7,代码来源:GradeBook.cs


示例19: PrintCaseStatements

 private static void PrintCaseStatements(TextWriter output, int branchCount, int value, int off)
 {
     for (var i = branchCount; i > 0; i >>= 1)
     {
         if ((i & value) != 0)
         {
             switch (i)
             {
                 case 32:
                     if (gEnableAvx) output.WriteLine("\t_memcpy32_avx(dst + {0}, src + {0});", off);
                     else output.WriteLine("\t_memcpy32_sse2(dst + {0}, src + {0});", off);
                     break;
                 case 16:
                     output.WriteLine("\t_memcpy16_sse2(dst + {0}, src + {0});", off);
                     break;
                 case 8:
                     output.WriteLine("\t*reinterpret_cast<uint64_t*>(dst + {0}) = *reinterpret_cast<uint64_t const*>(src + {0});", off);
                     break;
                 case 4:
                     output.WriteLine("\t*reinterpret_cast<uint32_t*>(dst + {0}) = *reinterpret_cast<uint32_t const*>(src + {0});", off);
                     break;
                 case 2:
                     output.WriteLine("\t*reinterpret_cast<uint16_t*>(dst + {0}) = *reinterpret_cast<uint16_t const*>(src + {0});", off);
                     break;
                 case 1:
                     output.WriteLine("\tdst[{0}] = src[{0}];", off);
                     break;
             }
             off += i;
         }
     }
 }
开发者ID:GHScan,项目名称:DailyProjects,代码行数:32,代码来源:Tool.cs


示例20: foreach

        void IDumpableAsText.DumpAsText(TextWriter writer)
        {
            var pbag = new List<KeyValuePair<String, String>>();
            Func<KeyValuePair<String, String>, String> fmt = kvp =>
            {
                var maxKey = pbag.Max(kvp1 => kvp1.Key.Length);
                return String.Format("    {0} : {1}", kvp.Key.PadRight(maxKey), kvp.Value);
            };

            Action<String> fillPbag = s =>
            {
                foreach (var line in s.SplitLines().Skip(1).SkipLast(1))
                {
                    var m = Regex.Match(line, "^(?<key>.*?):(?<value>.*)$");
                    var key = m.Result("${key}").Trim();
                    var value = m.Result("${value}").Trim();
                    pbag.Add(new KeyValuePair<String, String>(key, value));
                }
            };

            writer.WriteLine("Device #{0} \"{1}\" (/pci:{2}/dev:{3})", Index, Name, PciBusId, PciDeviceId);
            fillPbag(Simd.ToString());
            fillPbag(Clock.ToString());
            fillPbag(Memory.ToString());
            fillPbag(Caps.ToString());
            pbag.ForEach(kvp => writer.WriteLine(fmt(kvp)));
        }
开发者ID:xeno-by,项目名称:libcuda,代码行数:27,代码来源:CudaDevice.Core.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# IO.UnmanagedMemoryStream类代码示例发布时间:2022-05-26
下一篇:
C# IO.TextReader类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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