Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calling another class in another .cs file
Message
From
02/08/2002 11:30:25
 
 
To
02/08/2002 11:20:57
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, United States
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00685474
Message ID:
00685484
Views:
12
>For example, how can I get myclass2 in namespace2 to access something in myclass1 namespace1?

Try this:
//one.cs
using System;

namespace namespace1
public class myclass1
{
  public string mystring = ""
}

//two.cs
using System;
using namespace1;

namespace namespace2
public class myclass2
{

public static void Main ()
{
///Access namespace1.myclass1 in one.cs here.
myclass1 obj = new myclass1()
Console.WriteLine(obj.mystring);
}

}
Previous
Reply
Map
View

Click here to load this message in the networking platform