Coffeehouse Thread

7 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

VALUE -- keyword or ????

Back to Forum: Coffeehouse
  • User profile image
    antisocial

    can someone out there explain to me what VALUE is ??  a datatype or how it gets defined??  like :

    public int x; {

    get

    {return my_x;}

    set    

    {return value}

    plzzzzzz - thanks

     

  • User profile image
    felix9

    void x::set(int value) { my_x = value; }

  • User profile image
    blowdart

    @antisocial:Its the parameter passed to the setter, so you use it to set your variables.

    So if I have

    int x
    {
        get { return _x; }
        set { _x = value }
    }

    And did thing.x = 123 value would be 123.

     

  • User profile image
    JoshRoss

    IMHO, the VB.NET syntax is it easier to comprehend.

    Private _Prop2 As String = "Empty"
    Property Prop2 As String
        Get
            Return _Prop2
        End Get
        Set(ByVal value As String)
            _Prop2 = value
        End Set
    End Property

    In C#

    class TimePeriod
    {
        private double seconds;
    
        public double Hours
        {
            get { return seconds / 3600; }
            set { seconds = value * 3600; }
        }
    }

  • User profile image
    antisocial

    thanks all - i get it !

  • User profile image
    DeathBy​VisualStudio

    Ah the new C9... home of the trolls, Microsoft Kool-Aid drinkers, and kids who need help with their homework. Perplexed

  • User profile image
    Dr Herbie

    @DeathByVisualStudio: Stop being an anti-social jerk.  There's nothing wrong with people asking for help.

    Herbie

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.