BaconographyPortable.Model.Reddit.ThingUtility.HashifyListing C# (CSharp) Method

HashifyListing() public static method

public static HashifyListing ( IEnumerable listing ) : HashSet
listing IEnumerable
return HashSet
        public static HashSet<string> HashifyListing(IEnumerable<Thing> listing)
        {
            if (listing == null)
                return null;

            var hashifyListing = new Func<Thing, string>((thing) =>
            {
                if (thing.Data is Subreddit)
                {
                    return ((Subreddit)thing.Data).Name;
                }
                else
                    return null;
            });

            return new HashSet<string>(listing.Select(hashifyListing)
                    .Where(str => str != null));
        }