private string GetValue(ImageProperty value) { if (value.GetValue().GetType() == typeof(byte[])) { //Modification may be needed here depending on your requirments since an ASCII string //is not always in the tag value. string s = Encoding.ASCII.GetString((byte[])value.GetValue(), 0, ((byte[])value.GetValue()).Length); if (s.IndexOf('\0') > 0) { return(s.Substring(0, s.IndexOf('\0'))); } else { return(s); } } else { return(value.GetValue().ToString().Replace("\0", "")); } }