how does using work?

  • Thread starter Thread starter AAJ
  • Start date Start date
A

AAJ

Hi all

I have the following that looks at a XSD Table adapter

JobDescription.VWJobDescriptionMinEducationDataTable m_MinQuals;

but for compactness I would like to reference it as

Using JobDescription;

VWJobDescriptionMinEducationDataTable m_MinQuals;



but the 'using' part generates 'Error 1 A using namespace directive can only
be applied to namespaces; 'JobDescription' is a type not a namespace
E:\Inetpub\wwwroot\...' when I build the project

can anyone help

Andy
 
Hi Andy,

I would guess that JobDescription is a class, and that VWJob...Table is a
member of that class. In that case you would have to create an alias.

using JDescMinTable = JobDescription.VWJobDescriptionMinEducationDataTable;

JDescMinTable m_MinQuals;
 
In C#, using aliases namespaces or classes.
using System.Windows.Forms
aliases System.Windows.Forms as nothingso you can access is members directly.
using Forms = System.Windows.Forms
aliases it as Forms so you can get to TextBox as Forms.TextBox
using TB = System.Windows.Forms.TextBox
aliases the class as TB and there fore you can access it like
TB myTextbox = new TB();

What you need to do for your needs is :

using VWJobDescriptionMinEducationDataTable=
JobDescription.VWJobDescriptionMinEducationDataTable

Then you could write

VWJobDescriptionMinEducationDataTable m_MinQuals;

HTH


Ciaran O'Donnell
 
Back
Top