---
title: "Get Set Modifier in c#"  
description: "Get Set Modifier in c#"  
author: "Anonymous User"  
published: 2015-11-25  
updated: 2015-11-25  
canonical: https://www.mindstick.com/forum/33637/get-set-modifier-in-c-sharp  
category: "c#"  
tags: ["c#", ".net"]  
reading_time: 1 minute  

---

# Get Set Modifier in c#

How to use Get Set Modifier in c# please help me

## Replies

### Reply by Anonymous User

The get set modifier mostly used for storing and retrieving value from the private field. The get modifier must return a value of property type where set modifier returns void. The set modifier uses an implicit parameter called value. In simple word, the get method used for retrieving value from private field whereas set method used for storing value in private variables.

```
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace Get_SetTuorial{    class Getset     {        // String Variable declared as private        private static string _BookName;        public void print()        {            Console.WriteLine("\nMy Book is " + BookName);        }        public string BookName //Creating BookName property        {            get //get method for returning value            {                return _BookName;            }            set // set method for storing value in BookName field.            {                _BookName = value;            }        }    }    class MainApp    {        static void Main(string[] args)        {            Getset Obj = new Getset();            Console.Write("Enter your name:\t");            // Accepting value via BookName property            Obj.BookName = Console.ReadLine();            Obj.print();            Console.ReadLine();        }    }}
```

![Get Set Modifier in c#](https://www.mindstick.com/mindstickforums/1ea64f43-b238-439a-beed-25b214ae3811/images/78c16633-f308-4e1a-b782-d15dc8f99074.png)


---

Original Source: https://www.mindstick.com/forum/33637/get-set-modifier-in-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
