I have a class that I'm using to hold various data for my application. I never actually instantiate the class because I want the data to be accessible from all forms. I want to serialize this class, but it won't allow me to unless I create an instance of it. Is there a way around this or maybe a better way to accomplish what I'm trying to do?
Here is the class:
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.Serialization;
using System.IO;
namespace Man
{
public class ListProduct
{
public string Name;
public int Quantity;
public decimal Cost;
public DateTime Date;
}
public class Product
{
public string Name;
public bool IsCompound;
public decimal BuyPrice;
public decimal SellPrice;
public List<ListProduct> SubItems = new List<ListProduct>();
}
public class ListEmployee
{
public string FirstName;
public string LastName;
public decimal Cost;
public decimal Hours;
public DateTime Date;
}
public class Employee
{
public string FirstName;
public string LastName;
public decimal Wage;
}
[Serializable()]
public class Items : ISerializable
{
public static List<Product> ProdList = new List<Product>();
public static List<Employee> EmpList = new List<Employee>();
public static List<ListProduct> BuyList = new List<ListProduct>();
public static List<ListProduct> SellList = new List<ListProduct>();
public static List<ListEmployee> EmpHours = new List<ListEmployee>();
}
}