本文整理汇总了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);
}
示例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;
}
示例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
}
示例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}.");
}