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. Web Development
  3. What is ReadOnly?

What is ReadOnly?

Scheduled Pinned Locked Moved Web Development
tutorialquestioncsharp
2 Posts 2 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.
  • O Offline
    O Offline
    omkamal
    wrote on last edited by
    #1

    I had a strong belief that when a property of an Object is defined as ReadOnly then it means that you can only read its value at runtime and cannot modify the value. If this is wrong just donot read further, but just correct me. This is what I found confusing... In MSDN's documentation for Style property of a Web Control it says,... [Visual Basic] Public ReadOnly Property Style As CssStyleCollection [C#] public CssStyleCollection Style {get;} ... But then they have shown an example of how to use the "visibility" key of the CssStyleCollection to hide and unhide a label control programmatically, like this.... void Button1_Click(Object sender, EventArgs e) { Label1.Style["visibility"]= ((Label1.Style["visibility"]=="hidden")?"show":"hidden"); } If one is able to change a property's value then why the hell do they declare it as *ReadOnly*. And if you are a C# programmer, check out their declaration above that they dont have the set() method. Then how does it work???:confused: omkamal

    K 1 Reply Last reply
    0
    • O omkamal

      I had a strong belief that when a property of an Object is defined as ReadOnly then it means that you can only read its value at runtime and cannot modify the value. If this is wrong just donot read further, but just correct me. This is what I found confusing... In MSDN's documentation for Style property of a Web Control it says,... [Visual Basic] Public ReadOnly Property Style As CssStyleCollection [C#] public CssStyleCollection Style {get;} ... But then they have shown an example of how to use the "visibility" key of the CssStyleCollection to hide and unhide a label control programmatically, like this.... void Button1_Click(Object sender, EventArgs e) { Label1.Style["visibility"]= ((Label1.Style["visibility"]=="hidden")?"show":"hidden"); } If one is able to change a property's value then why the hell do they declare it as *ReadOnly*. And if you are a C# programmer, check out their declaration above that they dont have the set() method. Then how does it work???:confused: omkamal

      K Offline
      K Offline
      Konstantin Vasserman
      wrote on last edited by
      #2

      In this example they do not change the Style property - they change the value of one of the items in collection that is pointed to by Style property.

      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