Click here to Skip to main content
16,006,709 members
Home / Discussions / C#
   

C#

 
GeneralRe: Error with OleDb not found Pin
steve_rm8-Oct-04 20:18
steve_rm8-Oct-04 20:18 
GeneralWhy is "Refresh" needed?(Smooth Progress Bar User Control) Pin
Gary Perkin28-Sep-04 22:49
Gary Perkin28-Sep-04 22:49 
GeneralRe: Why is "Refresh" needed?(Smooth Progress Bar User Control) Pin
leppie29-Sep-04 1:00
leppie29-Sep-04 1:00 
GeneralRe: Why is "Refresh" needed?(Smooth Progress Bar User Control) Pin
kayhustle29-Sep-04 6:33
kayhustle29-Sep-04 6:33 
GeneralWSE 2.0 sp 1 problem Pin
sandu200428-Sep-04 22:35
sandu200428-Sep-04 22:35 
GeneralNO ONE KNOW THAT ??? what is the value ANY ONE REPLY ME PLZ Pin
MoustafaS28-Sep-04 22:26
MoustafaS28-Sep-04 22:26 
GeneralRe: NO ONE KNOW THAT ??? what is the value ANY ONE REPLY ME PLZ Pin
Stefan Troschuetz28-Sep-04 22:56
Stefan Troschuetz28-Sep-04 22:56 
GeneralRe: NO ONE KNOW THAT ??? what is the value ANY ONE REPLY ME PLZ Pin
benjymous29-Sep-04 2:27
benjymous29-Sep-04 2:27 
It lets you easily define access functions for a variable

In C++ you'd have something like

private:
  int myint;

public:
  int myint_get()
  {
    return myint;
  }

  void myint_set(int newval)
  {
    if( do some kind of check to make sure the value is valid )
    {
       myint = newval;
       do any processing that has to happen if myint changes
    }
  }


so in the main code, if you want to increment the value of myint you'd have to do something like obj.myint_set(obj.myint_get()+1); which is somewhat messy

In C# access functions are made much tidier, like so

private int myint;

public int MyInt
{
  get
  {
    return myint;
  }
  set
  {
    if( do some kind of check to make sure the value is valid )
    {
       myint = value;
       do any processing that has to happen if myint changes
    }
  }
}

in other words, to answer your question value is whatever gets passed into the set function, i.e. obj.MyInt = 42; --then value would be 42

this lets you do stuff like obj.MyInt++; and treat it as if you'd just declared a public variable in the first place (without any of the worry about messing up your value)

You can make a read only variable by omitting the set{} part, or make it write only by omitting the get{} part if you so desire

NOTE: This code was just written off the top of my head - it's not expected to actually compile

--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!

GeneralRe: NO ONE KNOW THAT ??? what is the value ANY ONE REPLY ME PLZ Pin
Nick Parker29-Sep-04 4:06
protectorNick Parker29-Sep-04 4:06 
GeneralRegistry and Eventlog!!! Pin
Member 140072028-Sep-04 21:38
Member 140072028-Sep-04 21:38 
GeneralRe: Registry and Eventlog!!! Pin
Rein Hillmann28-Sep-04 21:47
Rein Hillmann28-Sep-04 21:47 
GeneralI realy need help Pin
Sakkijha28-Sep-04 21:18
Sakkijha28-Sep-04 21:18 
GeneralRe: I realy need help Pin
Rein Hillmann28-Sep-04 21:27
Rein Hillmann28-Sep-04 21:27 
GeneralRe: I realy need help Pin
Sakkijha28-Sep-04 21:44
Sakkijha28-Sep-04 21:44 
GeneralRe: I realy need help Pin
Rein Hillmann28-Sep-04 22:00
Rein Hillmann28-Sep-04 22:00 
GeneralRe: I realy need help Pin
Stefan Troschuetz28-Sep-04 21:30
Stefan Troschuetz28-Sep-04 21:30 
GeneralRe: I realy need help Pin
Sakkijha28-Sep-04 21:51
Sakkijha28-Sep-04 21:51 
GeneralChanging standard look of scroll bars Pin
Vladimir Knezevic28-Sep-04 21:08
Vladimir Knezevic28-Sep-04 21:08 
GeneralRe: Changing standard look of scroll bars Pin
RichiLloyd5-Oct-04 0:43
RichiLloyd5-Oct-04 0:43 
Generala FUNCTION 2 CALCULATE SECONDS since time struck 12 Pin
compu2rbloo28-Sep-04 18:50
compu2rbloo28-Sep-04 18:50 
GeneralRe: a FUNCTION 2 CALCULATE SECONDS since time struck 12 Pin
Rein Hillmann28-Sep-04 21:15
Rein Hillmann28-Sep-04 21:15 
GeneralRe: a FUNCTION 2 CALCULATE SECONDS since time struck 12 Pin
Stefan Troschuetz28-Sep-04 21:21
Stefan Troschuetz28-Sep-04 21:21 
GeneralRe: a FUNCTION 2 CALCULATE SECONDS since time struck 12 Pin
compu2rbloo29-Sep-04 18:55
compu2rbloo29-Sep-04 18:55 
GeneralRe: a FUNCTION 2 CALCULATE SECONDS since time struck 12 Pin
Gavin Jeffrey29-Sep-04 20:32
Gavin Jeffrey29-Sep-04 20:32 
Generalpdf text manipulation Pin
Naga Sudha28-Sep-04 18:43
Naga Sudha28-Sep-04 18:43 

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.