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


C# DataRecord类代码示例

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


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

示例1: SkillInfoTableRecord

        public SkillInfoTableRecord(DataRecord dataRecord)
        {
            ValueStr = dataRecord;
            Id = ValueStr[0];

            Step = new List<SkillStepTableRecord>();
        }
开发者ID:tuyiherizon,项目名称:TableModifier,代码行数:7,代码来源:SkillInfoTable.cs

示例2: public_constructor_assigns_given_header_record

 public void public_constructor_assigns_given_header_record()
 {
     var header = new HeaderRecord();
     var data = new DataRecord(header);
     Assert.NotNull(data.HeaderRecord);
     Assert.Same(header, data.HeaderRecord);
 }
开发者ID:modulexcite,项目名称:KBCsv,代码行数:7,代码来源:DataRecordFixture.cs

示例3: parser_complies_with_rule_RL

        public void parser_complies_with_rule_RL()
        {
            var csv = "Kent,25,M,{0}Belinda,26,F{0}Tempany,0,F,{1}";
            string[] lineBreaks = { "\r\n", "\r", "\n" };
            string[] eofMarkers = { "\r\n", "\r", "\n", string.Empty };

            foreach (var lineBreak in lineBreaks)
            {
                foreach (var eofMarker in eofMarkers)
                {
                    var parser = this.CreateParserFromString(string.Format(csv, lineBreak, eofMarker));
                    var records = new DataRecord[3];

                    Assert.Equal(3, parser.ParseRecords(null, records, 0, records.Length));

                    Assert.Equal("Kent", records[0][0]);
                    Assert.Equal("25", records[0][1]);
                    Assert.Equal("M", records[0][2]);
                    Assert.Equal("", records[0][3]);

                    Assert.Equal("Belinda", records[1][0]);
                    Assert.Equal("26", records[1][1]);
                    Assert.Equal("F", records[1][2]);

                    Assert.Equal("Tempany", records[2][0]);
                    Assert.Equal("0", records[2][1]);
                    Assert.Equal("F", records[2][2]);
                    Assert.Equal("", records[2][3]);

                    Assert.False(parser.HasMoreRecords);
                }
            }
        }
开发者ID:mujiansu,项目名称:KBCsv,代码行数:33,代码来源:CsvParserComplianceFixture.cs

示例4: indexer_get_returns_corresponding_value_for_column

        public void indexer_get_returns_corresponding_value_for_column()
        {
            var data = new DataRecord(new HeaderRecord(new string[] { "Name", "Age", "Gender" }), new string[] { "Kent", "25", "M" });

            Assert.Equal("Kent", data["Name"]);
            Assert.Equal("25", data["Age"]);
            Assert.Equal("M", data["Gender"]);
        }
开发者ID:modulexcite,项目名称:KBCsv,代码行数:8,代码来源:DataRecordFixture.cs

示例5: TestSimpleConverterForNull

        public void TestSimpleConverterForNull()
        {
            var record = new DataRecord(new Tuple<string, object>("Id", null));
            _mapper.Column(model => model.Id, "Id", ctx => int.Parse(ctx.ColumnValue.As<string>() ?? "0"));

            var user = new TestUser();
            _mapper.Map(user, record);
            Assert.Equal(0, user.Id);
        }
开发者ID:jmptrader,项目名称:griffin,代码行数:9,代码来源:EntityMappingTest.cs

示例6: TestSimpleConverterForIntToString

        public void TestSimpleConverterForIntToString()
        {
            var record = new DataRecord(new Tuple<string, object>("Name", 42));
            _mapper.Column(model => model.Name, "Name", ctx => ctx.ColumnValue.As<string>());

            var user = new TestUser();
            _mapper.Map(user, record);
            Assert.Equal("42", user.Name);
        }
开发者ID:jmptrader,项目名称:griffin,代码行数:9,代码来源:EntityMappingTest.cs

示例7: OnRaiseDataEvent

        protected virtual void OnRaiseDataEvent(DataRecord.DataEvent e)
        {
            EventHandler<DataRecord.DataEvent> handler = RaiseDataEvent;

            if (handler != null)
            {
            handler(this, e);
            }
        }
开发者ID:rdodesigns,项目名称:Esoma-Data-Processor,代码行数:9,代码来源:Device.cs

示例8: indexer_get_throws_if_column_not_found

        public void indexer_get_throws_if_column_not_found()
        {
            var data = new DataRecord(new HeaderRecord(new string[] { "Name", "Age", "Gender" }), new string[] { "Kent", "25", "M" });
            string s;

            Assert.Throws<ArgumentException>(() => s = data["foo"]);
            Assert.Throws<ArgumentException>(() => s = data["name"]);
            var ex = Assert.Throws<ArgumentException>(() => s = data["GENDER"]);
            Assert.Equal("No column named 'GENDER' was found in the header record.", ex.Message);
        }
开发者ID:modulexcite,项目名称:KBCsv,代码行数:10,代码来源:DataRecordFixture.cs

示例9: BuildFromCSV

 public VehicleAdditionalDetails BuildFromCSV(DataRecord data)
 {
     Manufacturer = data["MANUFACTURER"];
     Model = data["MODEL"];
     RegistrationYearAndLetter = data["REGYEAR"];
     NumberOfDoors = data["NOOFDOORS"];
     Transmission = data["TRANSMISSION"];
     VehicleDescription = data["VEHICLEDESCRIPTION"];
     return new VehicleAdditionalDetails(Manufacturer, Model, RegistrationYearAndLetter, NumberOfDoors, Transmission, VehicleDescription);
 }
开发者ID:muruaaaa9,项目名称:Automated-Test,代码行数:10,代码来源:VehicleAdditionalDetailsMother.cs

示例10: TestPrimaryKey

        public void TestPrimaryKey()
        {
            _mapper.PrimaryKey(model => model.Id, "Id");
            Assert.Equal("Id", _mapper.PrimaryKeys.First());
            Assert.Equal("Id", _mapper.GetColumnName("Id"));

            var record = new DataRecord();
            record.Fields.Add(new Tuple<string, object>("Id", 10));
            var user = new TestUser();
            _mapper.Map(user, record);
            Assert.Equal(10, user.Id);
        }
开发者ID:jmptrader,项目名称:griffin,代码行数:12,代码来源:EntityMappingTest.cs

示例11: sendRecord

        protected override void sendRecord(DataRecord.DataRecord dr)
        {
            System.Console.WriteLine("Sending.");
              if (serv == null) throw new System.ArgumentNullException("TCPServer", "Client requires a reference to a TCP server.");

              //System.Console.WriteLine("Sending data to {0}.", client);
              try {
            serv.SendToClient(dr.getRecordAsJson(), client);
              } catch (Exception ex) {
            System.Console.WriteLine("Could not send data to {0}.", client);
              }
        }
开发者ID:rdodesigns,项目名称:Esoma-Data-Processor,代码行数:12,代码来源:TCPClient.cs

示例12: process

 /// Process the DataRecord. This is done asynchronously.
 public void process(ref DataRecord.DataRecord incoming)
 {
     bool runme = true;
       try{
     foreach (string field in requiredDataFields){
       if (!incoming.updated_fields.Contains(field))
       runme = false;
     }
     if (runme) this.run(incoming);
     this.run(incoming);
       } catch (Exception ex){ throw ex;}
       incoming.addData(data);
 }
开发者ID:rdodesigns,项目名称:Esoma-Data-Processor,代码行数:14,代码来源:Algorithm.cs

示例13: run

        protected override void run(DataRecord.DataRecord incoming)
        {
            // Sometimes the data trasmission is poor.
              Types.Skeleton skel = incoming.getData("Skeleton");
              if (skel._empty) return;

              // Must add the avatar's skeleton before the player's.
              mov.addAvatar(skel);
              mov.addPlayer(skel);

              // Calculate the total angular displacement.
              mov.run();
              data["ExerciseAdherence"] = mov.getFlail();
        }
开发者ID:rdodesigns,项目名称:Esoma-Data-Processor,代码行数:14,代码来源:ExerciseAdherence.cs

示例14: parser_complies_with_2_4

        public void parser_complies_with_2_4()
        {
            var csv = $"aaa,bbb,ccc";
            var parser = this.CreateParserFromString(csv);
            var records = new DataRecord[1];

            Assert.Equal(1, parser.ParseRecords(null, records, 0, records.Length));

            Assert.Equal("aaa", records[0][0]);
            Assert.Equal("bbb", records[0][1]);
            Assert.Equal("ccc", records[0][2]);

            Assert.False(parser.HasMoreRecords);
        }
开发者ID:modulexcite,项目名称:KBCsv,代码行数:14,代码来源:CsvParserRfc4180ComplianceFixture.cs

示例15: issue3_repro

        public void issue3_repro()
        {
            var csv = @"Col1,Col2,Col3
val1,val2,val3
val1,val2,";

            using (var reader = CsvReader.FromCsvString(csv))
            {
                reader.ReadHeaderRecord();
                var buffer = new DataRecord[100];
                var read = reader.ReadDataRecords(buffer, 0, buffer.Length);

                Assert.Equal(2, read);
            }
        }
开发者ID:mujiansu,项目名称:KBCsv,代码行数:15,代码来源:Issue3.cs


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