Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2005
Visual Studio
Visual C#
C# Reference
C# Keywords
Contextual Keywords
 set
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:
C# Language Reference
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:

  • 1.6.6.2 Properties

  • 10.6.2 Accessors

Reference

C# Keywords

Concepts

C# Programming Guide

Other Resources

C# Reference

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker