C
C#2y ago
Sam DZ

✅ Access array in another class

I'm making an class to write arrays content which is in another class how can i access them ? (OOP)
6 Replies
Angius
Angius2y ago
Well, depends Is it static? Access it with ClassName.PropertyName Is it not static? You'll need an instance
Sam DZ
Sam DZOP2y ago
@Angius This is
Angius
Angius2y ago
Well those are local variables So you cannot access them anywhere outside of this method
Sam DZ
Sam DZOP2y ago
Can you help me to solve this issue please! @Angius
Angius
Angius2y ago
You can use properties Then you'll be able to access them from the instance of the class Or you can make this method return what you need it to return
Sam DZ
Sam DZOP2y ago
@Angius I do it like this Public static string [] BOOKS = new string [200] Outside the method and it's worked ! Thank for giving hand 👏
Want results from more Discord servers?
Add your server