Export (0) Print
Expand All
3 out of 17 rated this helpful - Rate this topic

set (C# Reference)

Defines an accessor method in a property or indexer that set the value of the property or the indexer element. See Properties and Indexers for more information.

This is an example of a set accessor for a property called Seconds:

class TimePeriod
    private double _seconds;
    public double Seconds
        get { return _seconds;  }
        set { _seconds = value; }

For more information, see the following sections in the C# Language Specification:

  • Properties

  • 10.6.2 Accessors

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.