Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualAndy474

Posted 08 October 2012 - 03:11 PM

Why not try making the class Static?

e.g.
public static class ItemManager {
public static List MyItemsList = new List();
public static void GetitemByID(int ID) { return MyItemsList[Id]; }
}


then you can refer to it anywhere e.g. ItemManager.GetItemByID(3);

or, you could keep what you have and create a static class called Globals, and store it there , e.g.

public static class Globals {
	 public static ItemManager ItemsManager;
}

and refer to it like Globals.ItemsManager[ID];

edit: personally, I'd go with the 2nd approach.

#1Andy474

Posted 08 October 2012 - 03:10 PM

Why not try making the class Static?

e.g.
public static class ItemManager {
 public static List MyItemsList = new List();
 public static void GetitemByID(int ID) { return MyItemsList[Id]; }
}


then you can refer to it anywhere e.g. ItemManager.GetItemByID(3);

or, you could keep what you have and create a static class called Globals, and store it there , e.g.

public static class Globals {
     public static ItemManager ItemsManager;
}

and refer to it like Globals.ItemsManager[ID];

PARTNERS