W e b t u t o r i a l s

Visual Studio.NET IDE

Define C#.NET

C# Comment

C# Variables

C# Data Types

C# Escape Sequence

C# Operators


Format String

Operator Precedence

C# Keywords

Constant Variable

Type Conversion

Flow Control

Exercise on Loops and Nested Loop

C# Arrays

C# Strings

User-Define Methods

Variable Scope

C# Enumerations

C# Structure

C# Exception Handling

Object Oriented Programming

C# Classes

C# Constructor & Destructor

C# Inheritance

C# Polymorphism

C# Operator Overloading

C# Interface

Abstract Classes, Abstract Methods

Sealed Classes, Methods

C# Properties

C# Indexer

C# Delegates

C# Generics

C# Collection



Properties is use to access the private fields to read or write their values. A property consists of a get or set declaration, or both. A property can be read-write property, read-only property, or a write only property, according to the presence or absence of the get and set accessors. If both are present the property is read-write property. If only get is present it’s a read only property. And if only set is present it’s a write-only property.
The get is a parameter less method with a return value, and use to invoke the value of a private field to compute.
The set is use to assign a value of a private field.

    class ex
        private int rollno;
        public int RollNo
                return rollno;
                rollno = value;
    class Program
        static void Main(string[] args)
            ex obj = new ex();
            obj.RollNo = 100;
            Console.WriteLine("Rollno=" + obj.RollNo);