Char array for class

I have an incoming byte stream (unsigned char) from a file or network. I need this data placed in a class and are looking for a NET way of doing this.

I'm sure this has been doing this all the time, so I think there is a better way to do this than using BitConverter.

I understand that I have provided too much information. Let me try an example class:

class data { 
void doSmething(); 
int var1; 
float var2; 
} 

Then I want to pass the data (var1 and var2) contained in this class on top of f.ex. network socket and get data on the other end

+3
source share
4 answers

As John said, it's unclear what you need. Perhaps you are saying, maybe this is Binary Serialization , what are you looking for?

+3
source

, , , , MemoryStream, , . , Position 0, .

+1

2 Binary Serialization ( PiRX) XML Serialization, , XML :

 [Serializable]
    [XmlRoot("CONFIGURATION")]
    public class Configuration
    {
        EnterpriseCollection enterprises;
        public Configuration()
        {

            enterprises= new EnterpriseCollection();
        }
        [XmlElement("ENTERPRISE")]
        public EnterpriseCollection Enterprises
        {
            get
            {
                return this.enterprises;
            }
            set
            {
                this.enterprises = value;
            }
        }
        private string name;
        [XmlElement("NAME")]
        public string Name
        {
            get
            {
                return name;
            }
            set
            {
                name = value;
            }
        }
+1

std::string. char * , char *. - . http://www.cppreference.com/

0

All Articles