Home > Net >  In c # call other class variables in the project
In c # call other class variables in the project

Time:01-18

using System;
using System.Collections.Generic;
Using System. Linq;
Using System. The Text;
Using TestAssigntmentTwo;

The namespace AssignmentTwo
{
Class Program
{
The static void Main (string [] args)
{
Console. WriteLine (" your score is: "+ TestAssignmentTwo. Score).
Console.Read();
}
}
}
A project has been T project reference, at this time in A project to reference T project class variables, but prompt context there is no name

CodePudding user response:

Please, help me solve the, I can't think out, from the beginner to learn c #, what also not,

CodePudding user response:

Your reference under the engineering project, post your screenshot of c + +, you fool me?
Your xxxTwo is a project, you credit variables in which class? If the variable is a public static directly; Class name. The variable name, or to instantiate the class, first is the new object, we usually say that and then use this object. The variable!
Mobile phone back to you, for my professional thumb up!

CodePudding user response:

Where is the score defined, does not define how to call you,
Defined in testassigntwo called testassigntwo class, defined public static method called score

CodePudding user response:

Friend or read A book well, do you want to in A project called T project, introduces T in A project, of course,

CodePudding user response:

The somebody else to you using the namespace,,, not the name of the class
If you don't, you remove the TestAssignmentTwo, then wait for vs suggest to add the using

CodePudding user response:

The lazy way is to write A public class, you put some attributes bind to T public class, make A call

CodePudding user response:

refer to the second floor HyoJung response:
references to engineering project, below you posted your c + + screenshot, you fool me?
Your xxxTwo is a project, you credit variables in which class? If the variable is a public static directly; Class name. The variable name, or to instantiate the class, first is the new object, we usually say that and then use this object. The variable!
Mobile phone back to you, for my professional thumb up!

Elder brother, I didn't ask you, don't want to don't back to back, so the shelf

CodePudding user response:

Thanks for your reply (in addition to some people but temperament), problem has been solved,
  •  Tags:  
  • C#
  • Related