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


C# List.ToArray方法代码示例

本文整理汇总了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);
            }
        }
开发者ID:raysearchlabs,项目名称:spark,代码行数:49,代码来源:InitializerHub.cs

示例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);
            }
        }
开发者ID:Condeti,项目名称:spark,代码行数:57,代码来源:InitializerHub.cs


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