I have a solution with some projects. One of this projects is the one I've defined as main, also his class has a main Method.
Inside this class, I've defined some properties public and static. What I want to to is access to this properties from other project file. For example:
Project A:
namespace Cobra
{
public static class Program
{
public static int A;
public static int B;
...
Project B:
namespace Net
{
public class HttpHandler : IHttpHandler
{
...
public void ProcessRequest()
int a =Cobra.Program.A;
int b =Cobra.Program.B;
...
How can I do this??
EDIT:
If I add Project A as reference in Project B: "Adding this project as a reference, there will be a circular dependency."
Project B contain some other files, so having a reference to Project B in Project A is needed.
In Project B, Add a reference to Project A and add a using Cobra
statement to Project B wherever you want to access something from the Cobra (Project A) namespace.
You need to add a reference to Project A to project B - right click on the project node in the solution explorer, select references, then projects then Project A.
You will then have access to all the types in Project A.
See this How To on MSDN.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With