Reputation: 1256
I'm creating a solution in VS2010 for Outlook 2010 using C# that is comprised of 3 projects.
I've not gotten far, yet, as I can't seem to read the variables from A into B or C. I've added A as a reference to both B & C, but assigning a local variable in one of those to the value from A results only in a null (which I know is not true).
More clarification:
This is a set of 3 outlook add-ins.
Upvotes: 1
Views: 6145
Reputation: 21
Always insure that Public methods, properties, fields, etc. names indicate a distinct context to avoid usage and maintenance confusion.
For example, a single solution having dozens of projects should not have identically named properties:
Project A: public int ThisValue{get;set;} -> ProjAThisValue Project B: public int ThisValue{get;set;} -> ProjBThisValue
Failing to do so creates referencing nightmares.
Upvotes: 0
Reputation: 38820
You might have to past some code. But anyway, ensure that project A is a class library. It should be as simple as:
Project A
namespace A
{
public class AClass // note, this is **public**
{
// ctor
public AClass { }
public void AMethod { }
}
}
Project B (has A as a reference)
using A;
namespace B
{
public class BClass
{
// don't actually need "A" qualifier here as we're "using A" above, this is just for clarity
private A.AClass aClass_ = new A.AClass();
// ctor
public BClass()
{
aClass_.AMethod();
}
}
}
You'd have something similar in project C.
Upvotes: 1