Issue
How to add object to array in an other class? This is my code:
public class One
{
//Loots is a class
public static Loots[] lootsList = new Loots[] { };
}
public class Two
{
Loots MyLoots = new Loots();
// How to add MyLoots to lootsList in THIS class?
}
I don't want to use List
Solution
Accessing Static variable and method of another class
ClassName.StaticVariable;
OR
ClassName.StaticMethod;
NOTE:- Static variable and Method are active in whole Application.
use this
public class One
{
public static Loots[] lootsList = new Loots[1];
}
public class Two
{
Loots MyLoots = new Loots();
// How to add in THIS class, MyLoots to lootsList?
One.Loots[0]=MyLoots; //use this to access array of objects
}
enjoy coding .........
Answered By - sushildlh
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.