Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MyClass
- {
- public byte[] Bytes{get;set;}
- }
- MyClass obj = new MyClass();
- obj.Bytes = new byte[]{1,22,44,55};
- string s_result = Newtonsoft.Json.JsonConvert.SerializeObject(obj);
- // my s_result looks like {"Bytes":"KQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="}
- public class MyClass
- {
- [JsonIgnore]
- public byte[] Bytes{get;set;}
- public int[] MessageByte
- {
- get
- {
- if (this.Bytes == null)
- return null;
- int[] result = new int[this.Bytes.Length];
- for (int i = 0; i < this.Bytes.Length; i++)
- {
- result[i] = this.Bytes[i];
- }
- return result;
- }
- }
- }
Add Comment
Please, Sign In to add comment