Which version of .net framework are you using? If it is 3.0 or later; It is called Auto-Implemented Properties.
Auto-implemented properties make property-declaration more concise when no additional logic is required in the property accessors.

public class Student
    public int Roll { get; set; }
    public int Mark1 { get; set; }
    public int Mark2 { get; set; }
    public int Total { get { return Mark1 + Mark2; } }

class MainApp{
    static void Main()   {
        Student a = new Student();
        a.Roll = 10;
        a.Mark1 = 90;
        a.Mark2 = 40;

Post #2 belongs to .net framework 3.5. With .net framework 2.0 - It is called unimplemented property. If this property is declared in a class then it must qualified with an abstract modifier and hence a class becomes an abstract.

The same declaration can appear with Interface.

Yes, i did that and i got the kind of accessor i wanted, but abstract keyword appeared on property.

I want to do the same but without the abstract keyword appear on the property name.

If this can only be done in .net framework 3.5 that's ok. I will use .net framework 3.5.

But how to do that in .net framework 3.5.

What attributes should i set for


object to get the auto-implemented accessor.

I am so sorry,

I already read that.

But i was not able to figure it out.
Thanks, anyway

nccsbim071 ,
You solve this problem? I now have such a need.(你解决这个问题了?我现在也有这个需要的。)
My mailbox is : <<Email Snipped>>

Edited 5 Years Ago by __avd: Email Snipped.


I wrote this post long time ago. But even then i was not able to solve this problem.

This article has been dead for over six months. Start a new discussion instead.