Ejemplo n.º 1
0
        /// <summary>
        /// This returns the requested SoftwarePackage only if it only appears
        /// exactly once (as determined solely by name) in the input SoftwarePackage
        /// array.
        /// </summary>
        /// <param name="name">The product name to look for.</param>
        /// <param name="list">The array of SoftwarePackages to search.</param>
        /// <returns>The SoftwarePackage found, or null for none found or more
        /// than one found.</returns>
        public static SoftwarePackage FindOne(string name, SoftwarePackage[] list)
        {
            SoftwarePackage setup = null;

            foreach (SoftwarePackage s in list)
            {
                if (s.Name.Equals(name))
                {
                    if (setup != null)
                    {
                        return(null);
                    }
                    setup = s;
                }
            }
            return(setup);
        }
Ejemplo n.º 2
0
		/// <summary>
		/// This returns the requested SoftwarePackage only if it only appears 
		/// exactly once (as determined solely by name) in the input SoftwarePackage
		/// array.
		/// </summary>
		/// <param name="name">The product name to look for.</param>
		/// <param name="list">The array of SoftwarePackages to search.</param>
		/// <returns>The SoftwarePackage found, or null for none found or more
		/// than one found.</returns>
		public static SoftwarePackage FindOne(string name, SoftwarePackage[] list)
		{
			SoftwarePackage setup = null;

			foreach(SoftwarePackage s in list)
			{
				if (s.Name.Equals(name)) 
				{
					if (setup != null) return(null);
					setup = s;
				}
			}
			return(setup);
		}