B
BH
Hi C# & .NET detectives,
can you help with two problems I've encountered lately?
1) These seem equivalent to me but one fails and the other doesn't.
This fails with "type or namespace 'Security' could not be found" message:
//-----------
using System;
using System.Threading;
//...later...
Security.Principal.IPrincipal user = Thread.CurrentPrincipal;
//--------------
However, this succeeds:
//----------
// using System ...code now uses explicit System reference
using System.Threading;
//...later...
System.Security.Principal.IPrincipal user = Thread.CurrentPrincipal;
//----------
2) OK, how about this problem
This fails with "type or namespace STAThread cannot be found" message...
[STAThread]
static void Main()
{
Application.Run(new MainForm());
}
How do I use/refer to STAThread correctly?
Thanks for your time,
BH
can you help with two problems I've encountered lately?
1) These seem equivalent to me but one fails and the other doesn't.
This fails with "type or namespace 'Security' could not be found" message:
//-----------
using System;
using System.Threading;
//...later...
Security.Principal.IPrincipal user = Thread.CurrentPrincipal;
//--------------
However, this succeeds:
//----------
// using System ...code now uses explicit System reference
using System.Threading;
//...later...
System.Security.Principal.IPrincipal user = Thread.CurrentPrincipal;
//----------
2) OK, how about this problem
This fails with "type or namespace STAThread cannot be found" message...
[STAThread]
static void Main()
{
Application.Run(new MainForm());
}
How do I use/refer to STAThread correctly?
Thanks for your time,
BH