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. What is Lock in C#

What is Lock in C#

Scheduled Pinned Locked Moved C#
csharpdesignquestion
4 Posts 4 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.
  • R Offline
    R Offline
    Ravindra Bisen
    wrote on last edited by
    #1

    Hi i want to design account class. with lock keyword in withdraw method.

    P OriginalGriffO L 3 Replies Last reply
    0
    • R Ravindra Bisen

      Hi i want to design account class. with lock keyword in withdraw method.

      P Offline
      P Offline
      Peter Leow
      wrote on last edited by
      #2

      refer: lock Statement (C# Reference)[^]

      1 Reply Last reply
      0
      • R Ravindra Bisen

        Hi i want to design account class. with lock keyword in withdraw method.

        OriginalGriffO Offline
        OriginalGriffO Offline
        OriginalGriff
        wrote on last edited by
        #3

        Unless you are using threading within your application, lock is pretty much irrelevant. It will not prevent other instances of your application from making changes, even if they are on the same PC. However, the MSDN[^] article on lock covers it prety well if you are threading.

        Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952) Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)

        "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
        "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

        1 Reply Last reply
        0
        • R Ravindra Bisen

          Hi i want to design account class. with lock keyword in withdraw method.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Ok, but that's not a question. What do you want to know?

          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