本文整理汇总了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
}
示例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;
}
}
示例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;
}
示例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;
}
示例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(),
//.........这里部分代码省略.........
示例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;
}