---
title: "problem in get and set the data field"  
description: "problem in get and set the data field"  
author: "Anonymous User"  
published: 2011-01-29  
updated: 2011-05-20  
canonical: https://www.mindstick.com/forum/160/problem-in-get-and-set-the-data-field  
category: "oops"  
tags: ["oops"]  
reading_time: 1 minute  

---

# problem in get and set the data field

we write this [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii) but give the [exception](https://www.mindstick.com/articles/1824/objective-c-exception-handling) \

```
 class Program
    {
        static void Main(string[] args)
        {
            aa a = new aa();
            a.ff = 19;
        }
    }
    public class aa
    {
        int f1;
        public int ff
        {
            set
            {
                System.Console.WriteLine("in set " + value);
                f1 = value;
            }
        }
    }
```

what is the accurate solution of its?![problem in get and set the data field](https://www.mindstick.com/app_images/htmleditor.icons/eusa_wall.gif)

## Replies

### Reply by Anonymous User

Hi..

Are you sure that these set of codes give exception becuse I had tested it and it successfully execute.


---

Original Source: https://www.mindstick.com/forum/160/problem-in-get-and-set-the-data-field

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
