Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
プロジェクトにclass1.csを作成しましたpublic int a;
public int a;
同じプロジェクトで、名前空間 basic とクラス名 program を持つ別のプログラムがあり、そのプログラム クラスには main メソッドも含まれています。メイン メソッドで class1 のオブジェクトを作成しようとすると、エラー class1 が現在のコンテキストに存在しないか、アセンブリ参照がありません。
次のような追加されたアセンブリのnamesapceを含めることにより、クラスのインスタンスを作成してみてください
namespace.class1 c1 = new namesapce.class1();
または上記のような名前空間を含める
using namespace; class1 c1= new class1();
ここで、名前空間は、class1を含む名前空間の名前に置き換えられます。