Re: C# Website - Global Functions

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Nick Malik [Microsoft] (nickmalik_at_hotmail.nospam.com)
Date: 02/27/05


Date: Sat, 26 Feb 2005 22:22:42 -0800

Assuming you are using Visual Studio and are writing your app using
code-behinds, then simply create a class in any *.cs file in the project, or
create a new *.cs file in the project. Any page can simply create the
object and call the method, or, if you declare the method as "static" then
any code can simply call the method without creating an object first.

-- 
--- Nick Malik [Microsoft]
    MCSD, CFPS, Certified Scrummaster
    http://blogs.msdn.com/nickmalik
Disclaimer: Opinions expressed in this forum are my own, and not 
representative of my employer.
   I do not answer questions on behalf of my employer.  I'm just a 
programmer helping programmers.
--
"David P. Donahue" <ddonahue@ccs.neu.edu> wrote in message 
news:ONe3M$0GFHA.3484@TK2MSFTNGP12.phx.gbl...
> When I wrote websites in VB .NET, I would often put functions in Global 
> for all the pages to call.  Now, in C#, doing so results in "references to 
> non-static objects" and whatnot.  I realize what that means and all, but 
> what I'm wondering is what's the best way around it?  Say, for example, I 
> want a function that takes a username and a password and returns true or 
> false if it's a successful login, and I want any page or usercontrol in 
> the website to be able to call that function, where should I put it and 
> what syntax do I need?
>
>
> Regards,
> David P. Donahue
> ddonahue@ccs.neu.edu 


Relevant Pages

  • C# Website - Global Functions
    ... When I wrote websites in VB .NET, I would often put functions in Global ... Regards, ... David P. Donahue ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Real World Scalability and Ruby - Top 20
    ... David Vallner said: ... of websites which indeed CAN afford to "just throw more servers at it" ... Intranets, I can assure you some of the very worst delays, and ... give us a better research method in under 1 hour that works and does ...
    (comp.lang.ruby)
  • Re: A CHALLANGE TO CANTORIANS
    ... books and websites (not graduate-level set theory ... David C. Ullrich VS Robert Israel ... as "seldom post to flame-fests". ...
    (sci.math)
  • Re: Web - Buttons In A DataGrid or DataList
    ... Perfect:) Casting the "sender" object to an ImageButton was precisely ... how can I set it in the ItemTemplate so ... >>David P. Donahue ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Which Linux Makes The Best Firewall?
    ... David P. Donahue wrote: ... good network cards would easily double that. ... I suggest you look at the Bernstein DNS package as a replacement for the ...
    (comp.security.firewalls)