PC Review


Reply
Thread Tools Rate Thread

Code behind project and I need to declare a global veriable where do I do this since there is no .h file

 
 
Bryan G
Guest
Posts: n/a
 
      26th Mar 2004
Code behind project and I need to declare a global veriable where do I do
this since there is no .h file


 
Reply With Quote
 
 
 
 
Chad Myers
Guest
Posts: n/a
 
      26th Mar 2004
Bryan G wrote:
> Code behind project and I need to declare a global veriable where do I do
> this since there is no .h file


First things first, this isn't C. Second thing, this is an
object-oriented framework (.NET, of which C# is a language), so there is
no such thing as a 'global variable'.

What are you trying to accomplish specifically? There is a better way
besides using global variables.

-c
 
Reply With Quote
 
Ignacio Machin \( .NET/ C# MVP \)
Guest
Posts: n/a
 
      26th Mar 2004
Hi,

I assume you mean a Web Application, if so you can keep a reference in
either Application or Session.

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Bryan G" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Code behind project and I need to declare a global veriable where do I do
> this since there is no .h file
>
>



 
Reply With Quote
 
LC
Guest
Posts: n/a
 
      26th Mar 2004
Bryan:

Static members (static properties in your case) may help you.

//something like this:
class Globals{
//static fields
private static int _userId;

//static property
public static int UserId{
get {return _userId;}
set {_userId = value;}
}
}

LC



"Bryan G" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Code behind project and I need to declare a global veriable where do I do
> this since there is no .h file
>
>



 
Reply With Quote
 
LC
Guest
Posts: n/a
 
      26th Mar 2004
Hi,

In ASP.NET static properties maintain their values between clients request,
and so work like Application variables.

LC

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:(E-Mail Removed)...
> Hi,
>
> I assume you mean a Web Application, if so you can keep a reference in
> either Application or Session.
>
> Cheers,
>
> --
> Ignacio Machin,
> ignacio.machin AT dot.state.fl.us
> Florida Department Of Transportation
>
> "Bryan G" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Code behind project and I need to declare a global veriable where do I

do
> > this since there is no .h file
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to declare global Class library project? Ron Microsoft VB .NET 1 23rd Oct 2004 01:32 AM
Global Veriable ... Where to declare so all forms can see? =?Utf-8?B?Q2hyaXMgQg==?= Microsoft Access VBA Modules 5 21st Apr 2004 08:28 AM
Code behind project and I need to declare a global veriable where do I do it at Bryan G Microsoft ASP .NET 2 26th Mar 2004 10:51 PM
Code behind project and I need to declare a global veriable where do I do this since there is no .h file Bryan G Microsoft Dot NET 1 26th Mar 2004 08:31 PM
how to declare session variable in global.asax file khawar Microsoft ASP .NET 1 10th Jul 2003 09:03 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:14 PM.