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


C# List.Where方法代码示例

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


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

示例1: GetReferences

        public static IEnumerable<Uri> GetReferences(this BundleEntry entry, string include)
        {
            Resource resource = (entry as ResourceEntry).Resource;
            ElementQuery query = new ElementQuery(include);
            var list = new List<Uri>();

            query.Visit(resource, element =>
            {
                if (element is ResourceReference)
                {
                    Uri uri = (element as ResourceReference).Url;
                    if (uri != null) list.Add(uri);
                }
            });
            return list.Where(u => u != null);
        }
开发者ID:Ravenheart,项目名称:spark,代码行数:16,代码来源:BundleExtensions.cs

示例2: prepareResources

        /// <summary>
        /// Scan all xml files found by prepareFiles and find conformance resources + their id
        /// </summary>
        private void prepareResources()
        {
            if (_resourcesPrepared) return;

            prepareFiles();

            _resourceInformation = new List<ConformanceInformation>();

            foreach (var file in _artifactFilePaths.Where(af => Path.GetExtension(af) == ".xml"))
            {
                if (file.EndsWith("dataelements.xml")) continue;       // buggy file

                try
                {
                    var conformanceResources = readInformationFromFile(file).Where(ci =>
                           ResourceIdentity.IsRestResourceIdentity(ci.Url) &&
                           ModelInfo.IsConformanceResource((new ResourceIdentity(ci.Url)).ResourceType));
                    _resourceInformation.AddRange(conformanceResources);
                }
                catch(XmlException)
                {
                    throw;
                }
            }

            // Check for duplicate canonical urls, this is forbidden within a single source (and actually, universally,
            // but if another source has the same url, the order of polling in the MultiArtifactSource matters)
            var doubles = _resourceInformation.Where(ci=>ci.Url != null).GroupBy(ci => ci.Url).Where(group => group.Count() > 1);
            if (doubles.Any())
            {
                throw Error.InvalidOperation("The source has found multiple Conformance Resource artifacts with the same canonical url: {0} appears at {1}"
                        .FormatWith(doubles.First().Key, String.Join(", ", doubles.First().Select(hit => hit.Origin))));                        
            }

            _resourcesPrepared = true;
        }
开发者ID:tiloc,项目名称:fhir-net-api,代码行数:39,代码来源:FileDirectoryArtifactSource.cs

示例3: Prepare

        /// <summary>
        /// Prepares the source by reading all files present in the directory (matching the mask, if given)
        /// </summary>
        public void Prepare()
        {
#if !PORTABLE45
            _artifactFiles = new List<string>();

            IEnumerable<string> masks;
            if (Mask == null)
                masks = new string[] { "*.*" };
            else
                masks = Mask.Split('|').Select(s => s.Trim()).Where(s => !String.IsNullOrEmpty(s));

            // Add files present in the content directory
            var allFiles = new List<string>();

            foreach (var mask in masks)
            {
                allFiles.AddRange(Directory.GetFiles(_contentDirectory, mask, _includeSubs ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly));
            }

            var files = allFiles.Where(name => Path.GetExtension(name) != "exe" && Path.GetExtension(name) != "dll");
            
            _artifactFiles.AddRange(files);
            _isPrepared = true;
#else
            throw Error.NotImplemented("File based artifact source is not supported on the portable runtime");
#endif

        }
开发者ID:wdebeau1,项目名称:fhir-net-api,代码行数:31,代码来源:FileArtifactSource.cs

示例4: SearchPatientByGenderMissing

        public void SearchPatientByGenderMissing()
        {
            var patients = new List<ResourceEntry<Patient>>();
            var bundle = client.Search<Patient>();
            while (bundle != null && bundle.Entries.ByResourceType<Patient>().Count() > 0)
            {
                patients.AddRange(bundle.Entries.ByResourceType<Patient>());
                bundle = client.Continue(bundle);
            }
            var patientsNoGender = patients.Where(p => p.Resource.Gender == null);
            var nrOfPatientsWithMissingGender = patientsNoGender.Count();

            var actual = client.Search<Patient>(new string[] { "gender:missing=true" }, pageSize: 500).Entries.ByResourceType<Patient>();

            HttpTests.AssertCorrectNumberOfResults(nrOfPatientsWithMissingGender, actual.Count(), "Expected {0} patients without gender, but got {1}.");
        }
开发者ID:nagyistoce,项目名称:furore-sprinkler,代码行数:16,代码来源:SearchTest.cs


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