© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
19 replies
drewhosick

accessing an instance of a class in another class

How do you access an instance of a class variable or method if you need to access it from another class? I created the instance in the main program. Do I have to pass it all as arguments and then assign it to another instance of the class created in the method of the other class or is there a better way?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ accessing object from a class inside of another class
C#CC# / help
3y ago
❔ Accessing variable from another class
C#CC# / help
3y ago
Creating an instance of a class using DI [Answered]
C#CC# / help
4y ago
How to share instance of an object in base class to its inherited classes?
C#CC# / help
3y ago