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


C# CsvRow.Add方法代码示例

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


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

示例1: RunCommand

 public void RunCommand(string cmd)
 {
     CsvRow row = new CsvRow();
     row.Add(DateTime.Now.format("dd-MM-yyyy HH:mm:ss"));
     row.Add(this.Com);
     row.Add(this.Name);           
     try
     {
         string msg = string.Format(cmd, this.board, this.pos);
          row.Add(msg);
         if (App.listSerialPort != null)
         {
             for (int i = 0; i < App.listSerialPort.Count; i++)
             {
                 if (this.Com.ToLower() == App.listSerialPort[i].PortName.ToLower())
                 {
                     App.listSerialPort[i].sendCommand(msg);
                     break;
                 }
             }
         }
     }
     catch (Exception)
     {
        
     }
     
     App.RowsSend.Add(row);
 }
开发者ID:iceriver102,项目名称:alta-mtc-version-2,代码行数:29,代码来源:Alarm.cs

示例2: Generate

        public void Generate()
        {
            foreach (IAdj adj in _adjs)
            {
                SortedList<DateTime, AdjRateDatum> adjRateData = CreateAdjRateData(adj);

                //String dir = Directory.GetCurrentDirectory();
                //String path = dir + "\\" + _excelAdjResultFileName;

                CsvFileWriter writer = new CsvFileWriter(String.Format("{0}_result.csv", adj.ToString()));
                WriteHeader(writer);

                foreach (KeyValuePair<DateTime, AdjRateDatum> datum in adjRateData)
                {
                    CsvRow row = new CsvRow();
                    row.Add(datum.Key.ToString("yyyy-MM-dd"));
                    row.Add(datum.Value.KospiRate.ToString("n5"));
                    row.Add(datum.Value.KtbRate.ToString("n5"));
                    row.Add(datum.Value.DollarRate.ToString("n5"));

                    writer.WriteRow(row);
                }

                writer.Close();
            }
        }
开发者ID:HongSeokHwan,项目名称:legacy,代码行数:26,代码来源:AdjExcelAdjResultConverter.cs

示例3: WriteHeader

        void WriteHeader(CsvFileWriter writer)
        {
            CsvRow row = new CsvRow();
            row.Add("Date");
            row.Add("KospiRate");
            row.Add("KtbRate");
            row.Add("DollarRate");

            writer.WriteRow(row);
        }
开发者ID:HongSeokHwan,项目名称:legacy,代码行数:10,代码来源:AdjExcelAdjResultConverter.cs

示例4: WriteHeader

 void WriteHeader(CsvFileWriter writer)
 {
     CsvRow row = new CsvRow();
     row.Add("DateTime");
     row.Add("EventPoint");
     foreach (String key in _indicators.GetKeys())
     {
         row.Add(key);
     }
     writer.WriteRow(row);
 }
开发者ID:HongSeokHwan,项目名称:legacy,代码行数:11,代码来源:EventPointsIndicatorsFileWriter.cs

示例5: AbrirArchivo

 private static CsvFileWriter AbrirArchivo()
 {
     string filepath = @"C:\Users\Angela\Desktop\estadisticasSimulacion.csv";
     CsvFileWriter writer = new CsvFileWriter(@filepath);
     //Escribo encabezados de las columnas del archivo
     CsvRow header = new CsvRow();
     header.Add("Reloj");
     header.Add("Promedio clientes en cola");
     header.Add("Uso servidor");
     header.Add("Clientes atendidos");
     header.Add("Demora promedio en cola");
     writer.WriteRow(header);
     return writer;
 }
开发者ID:tinchoabbate,项目名称:SimulacionColaMM1,代码行数:14,代码来源:Program.cs

示例6: CheckBandwidthUsage

            private static CsvRow CheckBandwidthUsage(DateTime now)
            {
                CsvRow row = new CsvRow();
                try
                {
                    NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces();
                    long bytesReceived = 0;
                    foreach (NetworkInterface inf in interfaces)
                    {
                        if (inf.OperationalStatus == OperationalStatus.Up &&
                            inf.NetworkInterfaceType != NetworkInterfaceType.Loopback &&
                            inf.NetworkInterfaceType != NetworkInterfaceType.Tunnel &&
                            inf.NetworkInterfaceType != NetworkInterfaceType.Unknown && !inf.IsReceiveOnly)
                        {
                            bytesReceived += inf.GetIPv4Statistics().BytesReceived;
                            if (row.Count == 0)
                            {
                                PhysicalAddress address = inf.GetPhysicalAddress();
                                byte[] macAddr = address.GetAddressBytes();
                                string tMac = "";
                                foreach (byte part in address.GetAddressBytes())
                                {
                                    tMac += (tMac.Length > 0 ? "-" : "") + (part < 16 ? "0" : "") + part.ToString("X", CultureInfo.InvariantCulture);
                                }
                                row.Add(inf.Description);
                                row.Add(tMac);
                            }
                        }
                    }
                    if (bytesReceivedPrev == 0)
                    {
                        bytesReceivedPrev = bytesReceived;
                    }
                    long bytesUsed = bytesReceived - bytesReceivedPrev;
                    double kBytesUsed = bytesUsed / 1024;
                    double mBytesUsed = kBytesUsed / 1024;
                    bytesReceivedPrev = bytesReceived;
                    row.Add(mBytesUsed.ToString());
                    row.Add(now.ToString());
                    row = (mBytesUsed.ToString() == "0") ? null : row;

                }
                catch (Exception Ex)
                {
                    WriteLog("Log Path :: " + Ex);
                }
                return row;
            }
开发者ID:thirudravidan,项目名称:MySample,代码行数:48,代码来源:networkUsage.cs

示例7: WriteToCsvFile

        public static void WriteToCsvFile(this DataTable dataTable, string filePath)
        {
            CsvFileWriter writer = new CsvFileWriter(filePath);
            StringBuilder fileContent = new StringBuilder();

            CsvRow row = new CsvRow();
            foreach (var col in dataTable.Columns)
                row.Add(col.ToString());
            writer.WriteRow(row);

            foreach (DataRow dr in dataTable.Rows)
            {
                row = new CsvRow();

                foreach (var column in dr.ItemArray)
                {
                    row.Add(column.ToString());
                }

                writer.WriteRow(row);
            }
            writer.Close();
            dataTable = null;
            System.Console.WriteLine(string.Format("Done writing to {0}.", filePath));
        }
开发者ID:cgabilla,项目名称:cKarp,代码行数:25,代码来源:DataTableExtensions.cs

示例8: ToCsv

        public void ToCsv()
        {
            const String kHeader = "CreditPolicyWithMA";
            String fileName = String.Format("{0}_{1}.csv", kHeader, DateTime.Now.ToString("yyyy_MM_dd HHmmssfff"));

            CsvFileWriter writer = new CsvFileWriter(fileName);
            WriteHeader(writer);
            foreach (LogRow log in _logs)
            {
                CsvRow row = new CsvRow();
                row.Add(log.CurDate.ToString("yyyy-MM-dd"));
                row.Add(log.KospiWeight.ToString());
                writer.WriteRow(row);
            }
            writer.Close();
        }
开发者ID:HongSeokHwan,项目名称:legacy,代码行数:16,代码来源:CreditPolicyWithMA.cs

示例9: writePlayers

 public void writePlayers(List<Player> listPlayers)
 {
     using (CsvFileWriter writer = new CsvFileWriter(file))
     {
         foreach (var item in listPlayers)
         {
             CsvRow row = new CsvRow();
             row.Add(item.Name);
             for (int i = 0; i < Constants.RaceNumber; i++)
             {
                 row.Add(item.Races[i].ToString());
                 row.Add(item.Victory[i].ToString());
                 row.Add(item.Defeat[i].ToString());
                 row.Add(item.Elo[i].ToString());
             }
             writer.WriteRow(row);
         }
     }
 }
开发者ID:dosimont,项目名称:sc2_matchmaker,代码行数:19,代码来源:PlayerWriter.cs

示例10: WriteBody

        void WriteBody(CsvFileWriter writer)
        {
            List<EventPoint> eps = _eventPoints.EventPoints;
            Dictionary<String, List<DateTimeDoublePair>> indicators = _indicators.GetIndicators(_targetDate);

            for (int i = 0; i < eps.Count; i = i + 2)
            {
                EventPoint ep = eps[i];
                CsvRow row = new CsvRow();
                row.Add(ep.DateTimeFrom.ToString("yyyy-MM-dd HH:mm:ss.fff"));
                row.Add(ep.RangeMax.ToString("n"));

                foreach (List<DateTimeDoublePair> pair in indicators.Values.ToList())
                {
                    row.Add(pair[i].DoubleValue.ToString("n"));
                    Trace.Assert(pair[i].DateTimeValue == ep.DateTimeFrom);
                }
                writer.WriteRow(row);
            }
        }
开发者ID:HongSeokHwan,项目名称:legacy,代码行数:20,代码来源:EventPointsIndicatorsFileWriter.cs

示例11: WriteHeader

        void WriteHeader(CsvFileWriter writer)
        {
            CsvRow row = new CsvRow();
            row.Add("LongCode");
            row.Add("ShortCode");
            row.Add("From");
            row.Add("To");
            row.Add("RangeMax");
            row.Add("RangeMin");

            writer.WriteRow(row);
        }
开发者ID:HongSeokHwan,项目名称:legacy,代码行数:12,代码来源:EventPointsFileWriter.cs

示例12: WriteBody

        void WriteBody(CsvFileWriter writer, List<EventPoint> eventPoints)
        {
            foreach (EventPoint ep in eventPoints)
            {
                CsvRow row = new CsvRow();

                row.Add(ep.LongCode);
                row.Add(ep.ShortCode);
                row.Add(ep.DateTimeFrom.ToString("yyyy-MM-dd HH:mm:ss.fff"));
                row.Add(ep.DateTimeTo.ToString("yyyy-MM-dd HH:mm:ss.fff"));
                row.Add(ep.RangeMax.ToString("n1"));
                row.Add(ep.RangeMin.ToString("n1"));

                writer.WriteRow(row);
            }
        }
开发者ID:HongSeokHwan,项目名称:legacy,代码行数:16,代码来源:EventPointsFileWriter.cs

示例13: ReadRow

        /// <summary>
        /// Reads a row of data from a CSV file
        /// </summary>
        /// <param name="row"></param>
        /// <returns></returns>
        public bool ReadRow(CsvRow row)
        {
            row.LineText = ReadLine();
            if (String.IsNullOrEmpty(row.LineText))
                return false;

            int pos = 0;
            int rows = 0;

            while (pos < row.LineText.Length)
            {
                string value;

                // Parse unquoted value
                int start = pos;
                while (pos < row.LineText.Length && row.LineText[pos] != ',')
                    pos++;
                value = row.LineText.Substring(start, pos - start);

                // Add field to list
                if (rows < row.Count)
                    row[rows] = value;
                else
                    row.Add(value);
                rows++;

                // Eat up to and including next comma
                while (pos < row.LineText.Length && row.LineText[pos] != ',')
                    pos++;
                if (pos < row.LineText.Length)
                    pos++;
            }
            // Delete any unused items
            while (row.Count > rows)
                row.RemoveAt(rows);

            // Return true if any columns read
            return (row.Count > 0);
        }
开发者ID:D4rkM4tter,项目名称:StoreOffice,代码行数:44,代码来源:CsvFileReader.cs

示例14: WriteGeoRoutes

 private static void WriteGeoRoutes()
 {
     if (routes_Filename != null)
     {
         using (CsvFileWriter writer = new CsvFileWriter(routes_Filename))
         {
             int routeID = 0;
             foreach (Route r in MapTools.routes.Values)
             {
                 {
                     foreach (Waypoint w in r.waypoints)
                     {
                         CsvRow row = new CsvRow();
                         //                row.Add(trip.id.ToString());
                         //                row.Add(trip.startTime.ToString());
                         row.Add(routeID.ToString());
                         row.Add(w.Lat.ToString());
                         row.Add(w.Lng.ToString());
                         row.Add(w.elapse.ToString());
                         row.Add(w.distance.ToString());
                         row.Add(w.Address);
                         writer.WriteRow(row);
                     }
                 }
                 routeID++;
             }
         }
     }
 }
开发者ID:TripThru,项目名称:Gateway,代码行数:29,代码来源:1397674645$MapTools.cs

示例15: WriteGeoLocationNames

 private static void WriteGeoLocationNames()
 {
     if (locationNames_Filename != null)
     {
         using (CsvFileWriter writer = new CsvFileWriter(locationNames_Filename))
         {
             foreach (string key in MapTools.locationNames.Keys)
             {
                 string name = MapTools.locationNames[key];
                 CsvRow row = new CsvRow();
                 //                row.Add(trip.id.ToString());
                 //                row.Add(trip.startTime.ToString());
                 row.Add(key);
                 row.Add(name);
                 writer.WriteRow(row);
             }
         }
     }
 }
开发者ID:TripThru,项目名称:Gateway,代码行数:19,代码来源:1397674645$MapTools.cs


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