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


C# DataSet.Add方法代码示例

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


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

示例1: Process

        //Chris Han add DeviceId to Json
        public async Task<DataSet> Process(DataSet dataset, CancellationToken ct, string DeviceId)
        {
#if AggravatedSerialization
            //Serialize the whole dataset as single json string
            var json = await Task.Factory.StartNew(
                new Func<object, string>(JsonConvert.SerializeObject),
                dataset,
                ct);

            var data = new Data();
            data.Add("stringContent", json);

            var output = new DataSet();
            output.Add(data);
            return output;

#else
            //Serialize each data as one json string
            foreach (var data in dataset)
            {
                data["DeviceId"] = DeviceId;//Chris han add DeviceId to Json
                var json = await Task.Factory.StartNew(
                    new Func<object, string>(JsonConvert.SerializeObject),
                    data,
                    ct);

                data.Add("stringContent", json);
            }

            return dataset;
#endif
        }
开发者ID:chris-han,项目名称:MTC-Beijing-Azure-IoT-Workshop,代码行数:33,代码来源:JsonSerializer.cs

示例2: Read

#pragma warning disable 1998
        public async Task<DataSet> Read(CancellationToken ct)
        {
            if (_generator == null)
            {
                return null;
            }
            else
            {
                var data = _generator.Read();
                data.Add("utcTimestamp", DateTime.UtcNow);

                var output = new DataSet();
                output.Add(data);
                return output;
            }
        }
开发者ID:chris-han,项目名称:MTC-Beijing-Azure-IoT-Workshop,代码行数:17,代码来源:DataGeneratorHost.cs

示例3: LoadDataSet

        public static DataSet LoadDataSet(HttpServerUtilityBase server)
        {
            if (dataSet == null)
            {
                lock (loadLock)
                {
                    if (dataSet == null)
                    {
                        dataSet = new DataSet();
                        dataSets = new List<DataSet>();
                        foreach (var ds in Directory.GetFiles(server.MapPath("~/App_Data"), "*.xml").Where(p => DataSetNames.Any(ds => ds == Path.GetFileNameWithoutExtension(p))).Select(p => LoadDataSet(p)))
                        {
                            dataSets.Add(ds);
                            dataSet.Add(ds);
                        }
                    }
                }
            }

            return dataSet;
        }
开发者ID:Pathfinder-Fr,项目名称:PathfinderDb.WebExplorer,代码行数:21,代码来源:MemoryDataSet.cs

示例4: Read

        public async Task<DataSet> Read(CancellationToken ct)
        {
            var output = new DataSet();

            using (var stream = new MemoryStream())
            {
                while (true)
                {
                    var status = await _transport.ReceiveCommand(stream, ct);
                    if (status != HttpStatusCode.OK)
                    {
                        break;
                    }

                    var data = new Data();
                    data.Add("bytesContent", stream.ToArray());

                    output.Add(data);
                }
            }

            return output;
        }
开发者ID:chris-han,项目名称:MTC-Beijing-Azure-IoT-Workshop,代码行数:23,代码来源:CloudGateway.cs

示例5: Main

        private static void Main(string[] args)
        {
            Console.WriteLine("Pathfinder-fr Wiki Export Parser v{0}", typeof (Program).Assembly.GetName().Version);

            allCommands = new List<ICommand>();
            allCommands.AddRange(CommandLoader.LoadCommandFromAssemblyOf(typeof (ICommand)));
            #if DEBUG
            allCommands.AddRange(CommandLoader.LoadCommandFromAssemblyOf(typeof (ScanConjurateurCommand)));
            #endif

            if (args == null || args.Length < FixedArgs || args.Any(x => x.Equals("/help", StringComparison.OrdinalIgnoreCase)))
            {
                ShowHelp();
                return;
            }

            Console.WriteLine();

            var xmlPath = args[0];
            var xmlOut = args[1];
            var commandName = args[2];

            if (!Directory.Exists(xmlPath))
            {
                Console.WriteLine("ERREUR: Le dossier spécifié {0} n'existe pas", xmlPath);
                return;
            }

            var options = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
            var commandNames = new List<string>();

            foreach (var arg in args.Skip(FixedArgs))
            {
                if (arg[0] == '/')
                {
                    if (arg.Length > 1)
                    {
                        var i = arg.IndexOf(':');

                        if (i == -1 || i == 1 || i == arg.Length - 1)
                        {
                            options.Add(arg.Substring(1), string.Empty);
                        }
                        else
                        {
                            options.Add(arg.Substring(1, i - 1), arg.Substring(i + 1));
                        }
                    }
                }
                else
                {
                    commandNames.Add(arg);
                }
            }

            Console.WriteLine("Commandes à exécuter :");
            var commands = LoadCommands(allCommands, commandName, commandNames);
            foreach (var command in commands)
            {
                Console.WriteLine("- {0}", command.Alias);
            }

            Console.WriteLine("Chargement de l'export wiki...");
            var export = new WikiExport();
            export.Load(xmlPath);

            ILog log = new ConsoleLog();
            FileLog fileLog = null;

            try
            {
                var dataSets = new DataSetCollection();
                dataSets.Lang = "fr-FR";

                string logFileName;
                if (options.TryGetValue("log", out logFileName))
                {
                    fileLog = new FileLog(logFileName);
                    log = new CombineLog(log, fileLog);
                }

                foreach (var command in commands)
                {
                    log.Information("Exécution commande {0}", command.Alias);
                    command.Wiki = export;
                    command.Log = log;
                    command.Execute(dataSets);
                }

                // Serialisation
                var directory = Path.GetDirectoryName(xmlOut);
                if (!string.IsNullOrWhiteSpace(directory) && !Directory.Exists(directory))
                {
                    Directory.CreateDirectory(directory);
                }

                var writers = new IDataSetWriter[]
                {
                    new XmlDataSetWriter(),
                    new JsonDataSetWriter(),
//.........这里部分代码省略.........
开发者ID:Pathfinder-Fr,项目名称:WikiExportParser,代码行数:101,代码来源:Program.cs

示例6: LoadAllData

        private void LoadAllData(LocateFile file)
        {
            DataSet channel1Data = new DataSet();
            DataSet channel2Data = new DataSet();

            string line;
            while ((line = streamReader.ReadLine()) != null)
            {
                string trimmedLine = line.Trim();
                if (trimmedLine.Length == 0)
                    continue;

                int[] tokens = TokenizeData(trimmedLine);

                if (tokens.Length != 8)
                    throw new Exception("Invalid number of data entries");

                channel1Data.Add(new Datum(new Vector(tokens[0], tokens[1]), CalculateAxialPosition(tokens[6], file)));
                channel2Data.Add(new Datum(new Vector(tokens[2], tokens[3]), CalculateAxialPosition(tokens[6], file)));
            }

            file.Channel1Data = channel1Data;
            file.Channel2Data = channel2Data;
        }
开发者ID:jamiehale,项目名称:locate-viewer,代码行数:24,代码来源:LocateFileReader.cs


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