i want to cast byte[] which i got from socket a class which I write it (Message).
I tried
byte[] data=new btyte[100];
.
.
.
Message m=(Message)data;
but it did not work and give me error
what should I do?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Assuming you are talking about a serialized object:
try this:
In case you are serializing the Message in some other way, you will have to parse it yourself, using a parametrized constructor or a static method that returns a new instance of the type.