public object FromString(string value) { Type valueType = this.AttributeInfo.DataType; if (valueType == typeof(string)) { return(value); } else if (valueType == typeof(UInt16)) { return(Convert.ToUInt16(value)); } else if (valueType == typeof(UInt32)) { return(Convert.ToUInt32(value)); } else if (valueType == typeof(Int16)) { return(Convert.ToInt16(value)); } else if (valueType == typeof(Int32)) { return(Convert.ToInt32(value)); } else if (valueType == typeof(Single)) { return(Convert.ToSingle(value)); } else if (valueType == typeof(bool)) { return(Convert.ToBoolean(value)); } else if (valueType == typeof(byte[])) { return(HexHelper.HexToByteUsingByteManipulation(value)); } else // Null, or Unsupported Type { return(value); } }