Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Beginner Questions

Beginner Questions

Scheduled Pinned Locked Moved C#
questionlearningcsharp
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    smitsky
    wrote on last edited by
    #1

    Hi. I am a new member of Code Project. I have some basic beginner questions, and wonder if this is the place to ask them. I'll ask one, and if there is a better area for beginner questions, please let me know. My current question involves the key word static. Could someone please give me an explanation of it's function? I am reading a Microsoft book on C#, and I am having trouble understanding what static is all about. I looked but do not find a FAQ on this site which answers such questions. Thanks, Steve

    J M 2 Replies Last reply
    0
    • S smitsky

      Hi. I am a new member of Code Project. I have some basic beginner questions, and wonder if this is the place to ask them. I'll ask one, and if there is a better area for beginner questions, please let me know. My current question involves the key word static. Could someone please give me an explanation of it's function? I am reading a Microsoft book on C#, and I am having trouble understanding what static is all about. I looked but do not find a FAQ on this site which answers such questions. Thanks, Steve

      J Offline
      J Offline
      Jay Shankar
      wrote on last edited by
      #2

      refer msdn for details Static [^]

      1 Reply Last reply
      0
      • S smitsky

        Hi. I am a new member of Code Project. I have some basic beginner questions, and wonder if this is the place to ask them. I'll ask one, and if there is a better area for beginner questions, please let me know. My current question involves the key word static. Could someone please give me an explanation of it's function? I am reading a Microsoft book on C#, and I am having trouble understanding what static is all about. I looked but do not find a FAQ on this site which answers such questions. Thanks, Steve

        M Offline
        M Offline
        Mustafa Ismail Mustafa
        wrote on last edited by
        #3

        The static modifier, keeps the method,property, or field "static in memory". That means it persists and you don't need to instantiate it. You use them all the time when programming in .NET... one very good example is when you use any of the public members of Console such as Write() or Read(). The wole point behind a static keyword is to allow use of the so&so method/field without creating a new instance... How else would you be able to run any of the programs you write? Look at the general structure of a Main method. [STAThread] public static void Main(string[] args) { Application.Run(new Form1()); } you can run Main at anytime, and you create a new instance of the Form1 and then the program runs. Also, Application.Run() happens to be a static method as well :) Got a coding problem? Hand it to the CodeDevil!

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups