Exemple #1
0
        /// <summary>
        /// Finds a commodity that has the sspecified name
        /// </summary>
        /// <param name="name">A commodity name to look for</param>
        /// <param name="comparisonOptions">Options used to compare the commodity names</param>
        /// <returns>The <see cref="Commodity"/> that was found, or null if the provided name does not match any commodity.</returns>
        /// <exception cref="ArgumentNullException">The provided name is null.</exception>
        public Commodity FindCommodityByName(string name, StringComparison comparisonOptions = StringComparison.InvariantCultureIgnoreCase)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name", "A commodity name cannot be null");
            }

            return(CommoditiesInternal.Where(c => c.Name.Equals(name, comparisonOptions)).FirstOrDefault());
        }