Beispiel #1
0
 /// <summary>
 /// Reads a collection of <see cref="Protein"/> objects from a file.
 /// </summary>
 public static ICollection <Protein> ReadFile(this IProteinCollectionSerializer serializer, string path)
 {
     using (var stream = File.OpenRead(path))
     {
         return(serializer.Deserialize(stream));
     }
 }
Beispiel #2
0
        /// <summary>
        /// Reads a collection of <see cref="Protein"/> objects from a resource described by a <see cref="Uri"/>.
        /// </summary>
        public static ICollection <Protein> ReadUri(this IProteinCollectionSerializer serializer, Uri address)
        {
            var client = new WebClient();

            using (var stream = client.OpenRead(address))
            {
                return(serializer.Deserialize(stream));
            }
        }