ParseOptionalVersion() public static method

public static ParseOptionalVersion ( string version ) : System.Version
version string
return System.Version
Exemplo n.º 1
0
 private static XElement FindEntry(XDocument document, string id, Version version)
 {
     return((from e in document.Root.Elements("package")
             let entryId = e.GetOptionalAttributeValue("id")
                           let entryVersion = VersionUtility.ParseOptionalVersion(e.GetOptionalAttributeValue("version"))
                                              where entryId != null && entryVersion != null
                                              where id.Equals(entryId, StringComparison.OrdinalIgnoreCase) &&
                                              version.Equals(entryVersion)
                                              select e).FirstOrDefault());
 }
Exemplo n.º 2
0
        public IEnumerable <PackageReference> GetPackageReferences()
        {
            XDocument document = GetDocument();

            if (document == null)
            {
                yield break;
            }

            foreach (var e in document.Root.Elements("package"))
            {
                string  id            = e.GetOptionalAttributeValue("id");
                string  versionString = e.GetOptionalAttributeValue("version");
                Version version       = VersionUtility.ParseOptionalVersion(versionString);

                yield return(new PackageReference(id, version));
            }
        }