本文整理汇总了C#中Hl7.Fhir.Model.List.ToArray方法的典型用法代码示例。如果您正苦于以下问题:C# List.ToArray方法的具体用法?C# List.ToArray怎么用?C# List.ToArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hl7.Fhir.Model.List
的用法示例。
在下文中一共展示了List.ToArray方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadData
public void LoadData()
{
try
{
//cleans store and index
Progress("Cleaning", 0);
store.Clean();
index.Clean();
Progress("Loading data...");
this.resources = GetExampleData();
var resarray = resources.ToArray();
var rescount = resarray.Count();
for (int x = 0; x <= rescount - 1; x++)
{
//Thread.Sleep(1000);
var res = resarray[x];
Key key = res.ExtractKey();
if (res.Id != null && res.Id != "")
{
service.Put(key, res);
}
else
{
service.Create(key, res);
}
// Sending message:
var msg = new ImportProgressMessage
{
Message = "Importing " + res.ResourceType.ToString() + " " + res.Id + "...",
Progress = (int)(x + 1) * 100 / rescount
};
Clients.Caller.sendMessage(msg);
}
Progress("Import completed!", 100);
}
catch (Exception e)
{
Progress("Error: " + e.Message);
}
}
示例2: LoadData
public void LoadData()
{
var messages = new StringBuilder();
messages.AppendLine("Import completed!");
try
{
//cleans store and index
Progress("Clearing the database...", 0);
fhirStore.Clean();
fhirIndex.Clean();
Progress("Loading examples data...", 5);
this.resources = GetExampleData();
var resarray = resources.ToArray();
ResourceCount = resarray.Count();
for (int x = 0; x <= ResourceCount - 1; x++)
{
var res = resarray[x];
// Sending message:
var msg = Message("Importing " + res.ResourceType.ToString() + " " + res.Id + "...", x);
Clients.Caller.sendMessage(msg);
try
{
//Thread.Sleep(1000);
Key key = res.ExtractKey();
if (res.Id != null && res.Id != "")
{
fhirService.Put(key, res);
}
else
{
fhirService.Create(key, res);
}
}
catch (Exception e)
{
// Sending message:
var msgError = Message("ERROR Importing " + res.ResourceType.ToString() + " " + res.Id + "... ", x);
Clients.Caller.sendMessage(msg);
messages.AppendLine(msgError.Message + ": " + e.Message);
}
}
Progress(messages.ToString(), 100);
}
catch (Exception e)
{
Progress("Error: " + e.Message);
}
}