Reputation: 1172
I have a project having a static and non-static class. I want to access this class variable and update from another project under same solution. How I can do this? [For both static and non-static case]
Upvotes: 1
Views: 2683
Reputation: 79929
Using FirstProject.ns;
, then you can use the class you want to access.Note that: the class you want to use in the second project should has at least an acces modifier public
in order to appear in your second project.
Upvotes: 3
Reputation: 94645
First of all your project must be library
type. Make sure that these (classes defined a project) types must be public and it will be good practice to use namespace.
namespace MyCompany
{
public class Foo {}
}
Upvotes: 0
Reputation: 9912
You will need to "Add reference" to your project with the class in your need in your "another project" and make sure your classes you want to use from another project are marked as "public". Then you can use these from your "another project" as usual.
Upvotes: 1