How to read a embedded resource image in C# and VB.NET

To read a embedded resource image in C# and VB.NET you can use the following snippet.

Sample C#

public static Image ReadEmbeddedRessourceImage(Assembly assembly, string searchPattern)
{
	var resourceName = assembly.GetManifestResourceNames().FirstOrDefault(x => x.Contains(searchPattern));
	using (var stream = assembly.GetManifestResourceStream(resourceName))
	{
		if (stream != null) return Image.FromStream(stream);
	}
	return null;
}

Sample VB.NET

Public Shared Function ReadEmbeddedRessourceImage(assembly As Assembly, searchPattern As String) As Image
	Dim resourceName = assembly.GetManifestResourceNames().FirstOrDefault(Function(x) x.Contains(searchPattern))
	Using stream = assembly.GetManifestResourceStream(resourceName)
		If stream IsNot Nothing Then
			Return Image.FromStream(stream)
		End If
	End Using
	Return Nothing
End Function

How to set the ios bookmark icon in HTML

To set the ios bookmark icon in HTML you can use the following snippet.

Sample HTML

<link rel="apple-touch-icon" href="iOs_Icon.png"/>

If your icon is already glossy, you can prevent the device from adding its own gloss by using.

Sample HTML

<link rel="apple-touch-icon-precomposed" href="iOs_Icon.png"/>