public static string ToStringValue(UInt32 value) { byte[] bytes = UInt32Ex.ToBytes(value); string result = string.Empty; foreach (byte b in bytes) { result += (char)b; } return(result);// System.Text.Encoding.UTF8.GetString(bytes); }
public static UInt32 FromStringValue(string value) { if (value.IsNullOrEmpty() || value.Length < 4) { throw new Exception("value is to small to contain any value"); } byte[] bytes = new byte[4]; for (int i = 0; i < bytes.Length; i++) { bytes[i] = (byte)value[i]; } //byte[] bytes = System.Text.Encoding.UTF8.GetBytes(value); return(UInt32Ex.FromBytes(bytes)); }