I have a class in C# which receives data from the socket and inherits from Form. Whenever it receives data, it fires an event.
ReceivedDone += new ReceivedDoneEventHandler(MyClass.DataReceiveDone);
then I have following functions:
Expand|Select|Wrap|Line Numbers
- public void DataReceiveDone(object sender, ReceivedDoneNotifyEventArgs e){
- byte[] buffer;
- buffer = new byte[e.Data.Length];
- e.Data.CopyTo(buffer, 0);
- DataReceived(buffer);
- }
- public virtual void DataReceived(byte[] bData)
- {
- MessageBox.Show("I am here");
- }
lblReading.Invoke(new OnDataReceiveCallback(this.OnDataReceive), bData);
I want user of the class to do this in easy way like,
lblReading.Test = BitConverter.ToInt16(bData, 0);
Any help?
Thanks in advance,
Haroon.