Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Calling another class in another .cs file
Message
De
02/08/2002 11:30:25
 
 
À
02/08/2002 11:20:57
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00685474
Message ID:
00685484
Vues:
14
>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);
}

}
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform