Guest User

Untitled

a guest
Nov 21st, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. [Serializable]
  2. class Price
  3. {
  4. private Product[] priceList;
  5. private int nElems;
  6. private double sum;
  7.  
  8. public Price()
  9. {
  10. priceList = new Product[100];
  11. nElems = 0;
  12. sum = 0.0;
  13. }}
  14.  
  15. Price price = new Price();
  16. BinaryFormatter binFormat = new BinaryFormatter();
  17. // Сохранить объект в локальном файле.
  18. using (Stream fStream = new FileStream("file.dat",
  19. FileMode.Create, FileAccess.Write, FileShare.None))
  20. {
  21. binFormat.Serialize(fStream, price);
  22. }
Add Comment
Please, Sign In to add comment