Binary Stream BinaryFormatter Store read data details test

Source: Internet
Author: User

Binary flow is very convenient to use, in order to better understand the application of it, I created a simple object to start testing its increased features and reduce features.

[Serializable]classData----------storage object at start time { Public stringName ="Namex";  Public stringCeshia ="AA";  Public stringCeshib ="BB"; } [Serializable]classData----------Modify the storage class in your code and add a new field { Public stringName ="Namex";  Public stringCeshia ="AA";  Public stringCeshib ="BB";  Public stringCeshic ="cc";  Public intMD = +;  Public Longml =2; }//after reading, the newly added values are given default initial values instead of the initial values specified in the code because they do not exist in the original storage file.            stringCeshic =NULL; intMD =0; Longml =0;//After you reduce the data, the original value is not affected. Store extra values are automatically ignored[Serializable]classData----------Modify the storage class in your code, { Public stringName ="Namex";  Public stringCeshia ="AA";  Public stringCeshib ="BB"; //Public String ceshic = "CC"; //public int MD = 21; //Public long ml = 2;        }//Note that the new added variable name can not be stored in the same name of the variable, if the same, the system will not because the variable type, but the judgment is a different variable value, and will throw an exception, reminding you that you cannot convert.[Serializable]classData----------Modify the storage class in your code, { Public stringName ="Namex";  Public stringCeshia ="AA";  Public stringCeshib ="BB"; //Public String ceshic = "CC"; //public int MD = 21; //Public long ml = 2;                Public stringml =2;//The newly added variable name is the same as the previously stored data variable name}

So when you add or delete a field multiple times, try to keep the name of the variable different, so that the increment or decrement field will remain compatible with the previous stored file!

Binary Stream BinaryFormatter Store read data details test

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.