当前位置: 首页>>代码示例>>C#>>正文


C# System.IO.StringWriter.Flush方法代码示例

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


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

示例1: Unwrap

 public object Unwrap()
 {
     System.IO.StringWriter sw = new System.IO.StringWriter();
       GenerateReportDataSet().WriteXml(sw, XmlWriteMode.WriteSchema);
       sw.Flush();
       return sw.ToString();
 }
开发者ID:dglaser,项目名称:Agent,代码行数:7,代码来源:RemotingManager.cs

示例2: ToString

        public static string ToString(Variant value, XmlMode mode)
        {
            using (System.IO.TextWriter ms = new System.IO.StringWriter())
            {
                using (XmlWriter writer = new XmlWriter(ms, mode))
                {
                    writer.WriteDocument(value);
                }

                ms.Flush();

                return ms.ToString();
            }
        }
开发者ID:proteanic,项目名称:protean,代码行数:14,代码来源:XmlWriter.cs

示例3: AsString

 public string AsString(SparqlResultsFormat format)
 {
     var g = new VDS.RDF.Graph();
     var results = new List<SparqlResult>();
     foreach (var graphUri in Graphs)
     {
         var s = new Set();
         s.Add(SparqlResultVariableName, g.CreateUriNode(new Uri(graphUri)));
         results.Add(new SparqlResult(s));
     }
     var rs = new SparqlResultSet(results);
     var writer = GetWriter(format);
     var sw = new StringWriter();
     writer.Save(rs, sw);
     sw.Flush();
     return sw.ToString();
 }
开发者ID:jaensen,项目名称:BrightstarDB,代码行数:17,代码来源:GraphListModel.cs

示例4: toJson

        public string toJson(Object o, TypeAliaser typeAliaser)
        {
            /**
                o2J.OmitDefaultLeafValuesInJs = true;
                o2J.LeafDefaultSet = lds;
            //  to do throw exception if this is not the case
            //  o2J.OmitMarkAsArrayFunction = false;
           **/

         
            StringWriter sw = new StringWriter();
            writeAsJson(o, sw, typeAliaser);
            sw.Flush();
            String str = sw.ToString();
            sw.Close();
            return str;
        }
开发者ID:houseelectricsopen,项目名称:dotnetserializer,代码行数:17,代码来源:Object2Json.cs

示例5: Serialize

        public static string Serialize(System.Collections.Generic.Dictionary<string, object> ht)
        {
            System.IO.StringWriter wr = new System.IO.StringWriter();
            wr.Write("{");

            //this should guarantee english decimal separators. If not, try en-us.
            //System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
            //System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;

            bool fFirst = true;

            foreach (var kvp in ht)
            {
                if (!fFirst)
                {
                    wr.WriteLine(",");
                }
                else
                {
                    wr.WriteLine();
                    fFirst = false;
                }
                wr.Write(string.Format("\t\"{0:S}\": ", kvp.Key));

                if (kvp.Value is double)
                    wr.Write(((double)kvp.Value).ToString());
                else if (kvp.Value is int)
                    wr.Write(((int)kvp.Value).ToString());
                else if (kvp.Value is long)
                    wr.Write(((long)kvp.Value).ToString());
                else if (kvp.Value is DateTime)
                    wr.Write(UnixTicks(((DateTime)kvp.Value)).ToString());
                else
                    wr.Write(string.Format("\"{0:S}\"", kvp.Value.ToString()));
            }

            wr.WriteLine();
            wr.WriteLine("}");
            wr.Flush();

            return wr.ToString();
        }
开发者ID:simgreci,项目名称:xetohub,代码行数:42,代码来源:EventHubWriter.cs

示例6: Query

        public string Query( QueryProtocol[] generics, bool includeSchema )
        {
            if( generics == null)
            {
                throw new ArgumentNullException("generics");
            }

            ClarifySession session = Global.GetSession( AuthHeader );

            ClarifyGenericSrvQuery query = new ClarifyGenericSrvQuery(session);
            DataSet ds = query.ExecuteDataSet( generics );

            using(System.IO.StringWriter sw = new System.IO.StringWriter() )
            {
                System.Xml.XmlTextWriter xmlWriter = new System.Xml.XmlTextWriter(sw);
                ds.WriteXml(xmlWriter, includeSchema ? XmlWriteMode.WriteSchema : XmlWriteMode.IgnoreSchema);
                sw.Flush();

                return sw.ToString();
            }
        }
开发者ID:DovetailSoftware,项目名称:dovetail-sdk-web-services,代码行数:21,代码来源:ClarifyDataAccessSrv.asmx.cs

示例7: GetValueFromPattern

        private string GetValueFromPattern(LoggingEvent loggingEvent, string pattern)
        {
            //Reset the pattern layout
            _patternLayout.ConversionPattern = pattern;
            _patternLayout.ActivateOptions();

            //Write the results
            var sb = new StringBuilder();
            using(var writer = new System.IO.StringWriter(sb))
            {
                _patternLayout.Format(writer, loggingEvent);
                writer.Flush();
                return sb.ToString();
            }
        }
开发者ID:Gelber,项目名称:gelf4net,代码行数:15,代码来源:GelfLayout.cs

示例8: ToXml

        /// <summary>
        /// Serializes a ModuleProcessInfo object to xml
        /// </summary>
        /// <param name="mpi">Object to serialize</param>
        /// <returns>string containing serialized xml object</returns>
        public static string ToXml(ModuleProcessInfo mpi)
        {
            XmlSerializer serializer;
            System.IO.StringWriter stream;
            System.Text.StringBuilder sb;

            sb = new System.Text.StringBuilder();
            stream = new System.IO.StringWriter(sb);
            serializer = new XmlSerializer(typeof(ModuleProcessInfo));
            serializer.Serialize(stream, mpi, null);
            stream.Flush();
            return sb.ToString();
        }
开发者ID:BioRoboticsUNAM,项目名称:Blackboard,代码行数:18,代码来源:ModuleProcessInfo.cs

示例9: Main

        static void Main()
        {
            // Create a new coordinate with some values
            Coordinate c = new Coordinate();
            c.SetDMS(00, 10, 20.8f, true, 30, 40, 50.9f, false);

            // Create a new coordinate list with
            CoordinateList cl = new CoordinateList();
            cl.Add(new Coordinate( 1.0f, 1.0f));
            cl.Add(new Coordinate(-2.4f, 1.5f));
            cl.Add(new Coordinate(-3.7f, 2.2f));
            cl.Add(new Coordinate(-2.0f, -.5f));

            // Show formatting capabilities
            MessageBox.Show(
                string.Format("String Formatting:\r\nD: {0:D}\r\nDM: {0:DM}\r\nDMS: {0:DMS}\r\nISO: {0:ISO}", c),
                "Formatting example");

            // Serialize coordinates to a string object
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            System.IO.StringWriter sw = new System.IO.StringWriter(sb);
            string part1, part2;

            // Single coordinate
            System.Xml.Serialization.XmlSerializer xs = new System.Xml.Serialization.XmlSerializer(typeof(Coordinate));
            xs.Serialize(sw, c);
            sw.Flush();
            part1 = sb.ToString();

            // Coordinate list
            sb.Length = 0;
            System.Xml.Serialization.XmlSerializer xsl = new System.Xml.Serialization.XmlSerializer(typeof(CoordinateList));
            xsl.Serialize(sw, cl);
            sw.Flush();
            part2 = sb.ToString();

            sw.Close();

            // Show serialized data
            MessageBox.Show(string.Format("Single coordinate:\r\n{0}\r\n\r\nCoordinate list:\r\n{1}", part1, part2),
                "Serialization example");

            // Deserialize single coordinate from a string object
            System.IO.StringReader sr = new System.IO.StringReader(part1);
            Coordinate c1 = (Coordinate)xs.Deserialize(sr);
            sr.Close();

            // Deserialize coordinate list from a string object
            sr = new System.IO.StringReader(part2);
            CoordinateList cl1 = (CoordinateList)xsl.Deserialize(sr);
            sr.Close();

            // Show properties of deserialized data
            string message = string.Format(
                "Single coordinate:\r\n{0}\r\nLatitude: {1}°\r\nLongitude: {2}°\r\n\r\nCoordinate list:\r\n",
                c1, c1.Latitude, c1.Longitude);
            foreach (Coordinate coord in cl1)
                message += coord.ToString() + "\r\n";

            MessageBox.Show(message, "Deserialization example");
        }
开发者ID:jaime-olivares,项目名称:coordinate,代码行数:61,代码来源:Program.cs

示例10: CopyText

        private static void CopyText(Stack<SyntaxNodeOrToken> stack, StringBuilder builder)
        {
            builder.Length = 0;

            if (stack != null && stack.Count > 0)
            {
                var writer = new System.IO.StringWriter(builder);

                foreach (var n in stack)
                {
                    n.WriteTo(writer);
                }

                writer.Flush();
            }
        }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:16,代码来源:SyntaxDiffer.cs

示例11: ToString

        public override string ToString()
        {
            System.IO.StringWriter w = new System.IO.StringWriter();

            w.Write("{");
            int cnt = m_components.Count;
            for (int i = 0; i < cnt; i++)
            {
                w.Write(m_components[i].ToString() + " ");
            }

            w.Write(" }");

            w.Flush();
            return w.ToString();
        }
开发者ID:kia92798,项目名称:tinyasn1,代码行数:16,代码来源:ObjectIdentifier.cs

示例12: MakeClass

        /// <summary>
        /// 生成class
        /// </summary>
        private void MakeClass()
        {
            string codestr = ((dynamic)ActionParama.Arg).pm;
            if (!IsNotEmptyString(codestr))
            {
                Outmsg("参数无效");
                return;
            }

            var gen = Prepare(codestr);
            if (gen == null)
            {
                Outmsg("初始化json代码逆向生成器失败");
                return;
            }

            try
            {
                gen.TargetFolder = null;
                gen.SingleFile = true;
                using (var sw = new System.IO.StringWriter())
                {
                    gen.OutputStream = sw;
                    gen.GenerateClasses();
                    sw.Flush();
                    var lastGeneratedString = sw.ToString();

                    CacheUtil.Remove(KeyCenter.GenJsonClass); //清除之前的缓存
                    CacheUtil.InsertCach(KeyCenter.GenJsonClass, lastGeneratedString);
                    Outmsg(true);
                }
            }
            catch (Exception ex)
            {
                Outmsg("Unable to generate the code: " + ex.Message);
            }
        }
开发者ID:joyhen,项目名称:DbTools,代码行数:40,代码来源:partialrequestcode.cs

示例13: ToString

        public override string ToString()
        {
            System.IO.StringWriter w = new System.IO.StringWriter();

            w.Write("{");
            int cnt = m_children.Count;
            for (int i = 0; i < cnt - 1; i++)
            {
                w.Write(" " + m_children[i].ToString() + ",");
            }
            if (cnt-1>=0)
                w.Write(m_children[cnt - 1].ToString());

            w.Write(" }");

            w.Flush();
            return w.ToString();
        }
开发者ID:kia92798,项目名称:tinyasn1,代码行数:18,代码来源:SequenceOf.cs

示例14: AOTransferWorker_DoWork

        private void AOTransferWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            YellowstonePathology.Business.Mongo.Server server = new Business.Mongo.TestServer(YellowstonePathology.Business.Mongo.MongoTestServer.LISDatabaseName);
            MongoCollection mongoCollection = server.Database.GetCollection<BsonDocument>("AccessionOrderCollection");

            DateTime lastTransferredDate = YellowstonePathology.Business.Gateway.AccessionOrderGatewayMongo.GetLastDateTransferred();
            DateTime currentTransferDate = lastTransferredDate.AddDays(1);

            while (true)
            {
                List<Business.MasterAccessionNo> masterAccessionNos = Business.Gateway.AccessionOrderGateway.GetMasterAccessionNoList(currentTransferDate);
                foreach (Business.MasterAccessionNo masterAccessionNo in masterAccessionNos)
                {
                    Business.Test.AccessionOrder ao = YellowstonePathology.Business.Persistence.DocumentGateway.Instance.PullAccessionOrder(masterAccessionNo.Value, Window.GetWindow(this));

                    System.Text.StringBuilder sb = new System.Text.StringBuilder();
                    System.IO.StringWriter sw = new System.IO.StringWriter(sb);

                    YellowstonePathology.Business.Persistence.JSONObjectStreamWriter.Write(sw, ao);
                    sw.Flush();
                    sw.Close();

                    BsonDocument bsonDocument = BsonDocument.Parse(sb.ToString());
                    mongoCollection.Update(Query.EQ("MasterAccessionNo", ao.MasterAccessionNo), Update.Replace(bsonDocument), UpdateFlags.Upsert);

                    this.m_AOTransferWorker.ReportProgress(0, currentTransferDate.ToShortDateString() + " - " + masterAccessionNo.Value);
                }

                YellowstonePathology.Business.Gateway.AccessionOrderGatewayMongo.InsertLastDateTransferrred(currentTransferDate);
                currentTransferDate = currentTransferDate.AddDays(1);

                if(this.m_AOTransferWorker.CancellationPending == true)
                {
                    break;
                }
                if (currentTransferDate > DateTime.Today)
                {
                    break;
                }
            }
        }
开发者ID:WilliamCopland,项目名称:YPILIS,代码行数:41,代码来源:MongoMigrationWindow.xaml.cs

示例15: PrintProductBarcode

        public void PrintProductBarcode(int poSysNo)
        {
            HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment; filename=po.txt");
            HttpContext.Current.Response.Charset = "GB2312";
            HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
            HttpContext.Current.Response.ContentType = "application/vnd.ms-txt";

            System.IO.StringWriter tw = new System.IO.StringWriter();

            POInfo poInfo = LoadPO(poSysNo);
            int stockSysNo = poInfo.StockSysNo;

            string sql = @"select [pi].sysno,[pi].productsysno,inv.position1 as stockno from Product_ID [pi]
                           left join Inventory_Stock inv on [pi].productsysno=inv.productsysno
                           where [pi][email protected] and [pi].posysno=" + poSysNo + " and inv.stocksysno=" + stockSysNo + " order by [pi].sysno";
            sql = sql.Replace("@status", ((int)AppEnum.BiStatus.Valid).ToString());
            DataSet ds = SqlHelper.ExecuteDataSet(sql);

            string sLine = "\"ID\",\"ProductID\",\"Quantity\",\"StockNo\"";

            tw.WriteLine(sLine);
            int i = 1;
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                sLine = "\"" + i + "\",\"" + Util.TrimIntNull(dr["productsysno"]) + "_" + Util.TrimIntNull(dr["sysno"]) + "\",\"1\",\"" + Util.TrimNull(dr["stockno"]) + "\"";
                tw.WriteLine(sLine);
                i++;
            }

            tw.Flush();
            tw.Close();
            HttpContext.Current.Response.Write(tw.ToString()); //Write the HTML back to the browser.
            HttpContext.Current.Response.End();
        }
开发者ID:ue96,项目名称:ue96,代码行数:34,代码来源:PurchaseManager.cs


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