Hi
Have any of you had experience using byte[] in C# as a property for saving file attachments?
I have this property in a BO
public byte[] BinaryForm{
get{
CanReadProperty(
"BinaryForm", true); return _binaryForm;}
set{
CanWriteProperty(
"BinaryForm", true); if (!_binaryForm.Equals(value)){
_binaryForm =
value;PropertyHasChanged(
"BinaryForm");}
}
}
I am experiencing a NullReferenceException when assigning to it in a WinForm app like this
_verification.Attachments[e.RowIndex].BinaryForm = binaryForm;
The same verification BO is also used as bindingdatasource for a datagridview.
Thanks for any help.
Yeah,
Make sure to initialize your variable. e.g. private byte[] _binaryForm = new byte[42]. Otherwise it will be null when it does the .Equals check.
Mike
Copyright (c) Marimer LLC