XCore.XMessageBoxExManager.GetIcon C# (CSharp) Method

GetIcon() protected method

protected GetIcon ( string name ) : System.Drawing.Icon
name string
return System.Drawing.Icon
		protected System.Drawing.Icon GetIcon(string name)
		{
			name += ".ico";

			Stream iconStream = null;
			try
			{
				var assembly = System.Reflection.Assembly.GetAssembly(GetType());
				foreach (string resourcename in assembly.GetManifestResourceNames())
				{
					if (resourcename.EndsWith(name))
					{
						iconStream = assembly.GetManifestResourceStream(resourcename);
						Debug.Assert(iconStream != null, "Could not load the " + name + " resource.");
						break;
					}
				}
				Debug.Assert(iconStream != null, "Could not load the " + name + " resource.");
				return new System.Drawing.Icon(iconStream);
			}
			finally
			{
				if (iconStream != null)
					iconStream.Dispose();
			}
		}