Click here to Skip to main content
15,914,795 members
Home / Discussions / C#
   

C#

 
QuestionDistributing a much-used function across classes Pin
spin vector25-Feb-06 6:33
spin vector25-Feb-06 6:33 
AnswerRe: Distributing a much-used function across classes Pin
CWIZO25-Feb-06 6:39
CWIZO25-Feb-06 6:39 
GeneralRe: Distributing a much-used function across classes Pin
spin vector25-Feb-06 6:53
spin vector25-Feb-06 6:53 
AnswerRe: Distributing a much-used function across classes Pin
leppie25-Feb-06 6:49
leppie25-Feb-06 6:49 
GeneralRe: Distributing a much-used function across classes Pin
spin vector25-Feb-06 6:58
spin vector25-Feb-06 6:58 
AnswerRe: Distributing a much-used function across classes Pin
Allah On Acid25-Feb-06 7:03
Allah On Acid25-Feb-06 7:03 
GeneralRe: Distributing a much-used function across classes Pin
spin vector25-Feb-06 7:20
spin vector25-Feb-06 7:20 
GeneralRe: Distributing a much-used function across classes Pin
Allah On Acid25-Feb-06 7:42
Allah On Acid25-Feb-06 7:42 
You can name it whatever you want, i usually use "utility".

With static methods, you dont need an object reference to call them, so if you have a class with static methods, for instance

<br />
public class test<br />
{<br />
  private static string helloworld = "Hello World!";<br />
  public static void HelloWorld()<br />
  {<br />
    MessageBox.Show(helloworld);<br />
  }<br />
}<br />


you could call that method from anywhere in the program, like this:

test.HelloWorld();

Since static methods require no object reference, you call them using the class name, instead of a variable name. Also, when using static methods, anything else in the class that they use also has to be static.

Classes with static methods are kind of like modules in VB.net

Hope this helps.
GeneralRe: Distributing a much-used function across classes Pin
spin vector25-Feb-06 8:17
spin vector25-Feb-06 8:17 
GeneralRe: Distributing a much-used function across classes Pin
Allah On Acid25-Feb-06 8:25
Allah On Acid25-Feb-06 8:25 
GeneralRe: Distributing a much-used function across classes Pin
spin vector25-Feb-06 8:31
spin vector25-Feb-06 8:31 
AnswerRe: Distributing a much-used function across classes Pin
mrsnipey1-Mar-06 18:23
mrsnipey1-Mar-06 18:23 
Questioncreate c# window form installer Pin
batmanAgen25-Feb-06 5:28
batmanAgen25-Feb-06 5:28 
QuestionDeployment in VS2005. Pin
ranzask25-Feb-06 2:49
ranzask25-Feb-06 2:49 
QuestionSecond Email about How to Print in Windows Forms ?? Pin
Abubakarsb25-Feb-06 1:36
Abubakarsb25-Feb-06 1:36 
AnswerRe: Second Email about How to Print in Windows Forms ?? Pin
emran83425-Feb-06 1:56
emran83425-Feb-06 1:56 
QuestionWindow resizing Pin
XeoN-Kc25-Feb-06 1:22
XeoN-Kc25-Feb-06 1:22 
AnswerRe: Window resizing Pin
User 665825-Feb-06 2:30
User 665825-Feb-06 2:30 
GeneralRe: Window resizing Pin
XeoN-Kc25-Feb-06 2:42
XeoN-Kc25-Feb-06 2:42 
GeneralRe: Window resizing Pin
User 665825-Feb-06 3:25
User 665825-Feb-06 3:25 
AnswerRe: Window resizing Pin
Robert Rohde26-Feb-06 6:35
Robert Rohde26-Feb-06 6:35 
GeneralRe: Window resizing Pin
XeoN-Kc28-Feb-06 1:37
XeoN-Kc28-Feb-06 1:37 
Questionclass Image Pin
videhr24-Feb-06 23:52
videhr24-Feb-06 23:52 
AnswerRe: class Image Pin
James Gupta25-Feb-06 0:12
professionalJames Gupta25-Feb-06 0:12 
GeneralRe: class Image Pin
videhr25-Feb-06 4:58
videhr25-Feb-06 4:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.