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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. static variable

static variable

Scheduled Pinned Locked Moved C#
csharpc++question
6 Posts 4 Posters 1 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.
  • H Offline
    H Offline
    hkl
    wrote on last edited by
    #1

    Hi, may I know how I can declare a static variable in a simple application? I know that in C/C++, static int x can be used. How about in C#? Thanks.

    G H R 3 Replies Last reply
    0
    • H hkl

      Hi, may I know how I can declare a static variable in a simple application? I know that in C/C++, static int x can be used. How about in C#? Thanks.

      G Offline
      G Offline
      Guillermo Rivero
      wrote on last edited by
      #2

      same way man... static int whatever; Free your mind...

      1 Reply Last reply
      0
      • H hkl

        Hi, may I know how I can declare a static variable in a simple application? I know that in C/C++, static int x can be used. How about in C#? Thanks.

        H Offline
        H Offline
        hkl
        wrote on last edited by
        #3

        Ooh, I fount out that static declaration!! And, I solved that page number problem that I posted some time earlier!! Finally~!

        1 Reply Last reply
        0
        • H hkl

          Hi, may I know how I can declare a static variable in a simple application? I know that in C/C++, static int x can be used. How about in C#? Thanks.

          R Offline
          R Offline
          Rocky Moore
          wrote on last edited by
          #4

          One catch with static is that they are only class level and not method level as you can in C++. Rocky <>< www.GotTheAnswerToSpam.com

          L 1 Reply Last reply
          0
          • R Rocky Moore

            One catch with static is that they are only class level and not method level as you can in C++. Rocky <>< www.GotTheAnswerToSpam.com

            L Offline
            L Offline
            leppie
            wrote on last edited by
            #5

            Or global like C. leppie::AllocCPArticle("Zee blog");
            Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.

            H 1 Reply Last reply
            0
            • L leppie

              Or global like C. leppie::AllocCPArticle("Zee blog");
              Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.

              H Offline
              H Offline
              hkl
              wrote on last edited by
              #6

              Thanks all!!

              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