How would this class be created in the latest version of C#

Below is an example class created about a decade ago. I know things have changed for what is considered the standard but what would that look like?

using System; using System.Collections.Generic; using System.Text; namespace Interface.Library.Model { [Serializable] public class MTF { private int mId; private string mMTF_NAME; private string mMTF_DMIS; private bool mIsActive; public int Id { get { return mId; } set { mId = value; } } public string MTF_NAME { get { return mMTF_NAME; } set { mMTF_NAME = value; } } public string MTF_DMIS { get { return mMTF_DMIS; } set { mMTF_DMIS = value; } } public bool IsActive { get { return mIsActive; } set { mIsActive = value; } } } } 

Maybe…

namespace Interface.Library.Model { [Serializable] public class MTF { public int Id { get; set; } 

And what about [Serializable]? Is it still done like it's shown above?

by SequesterMe via /r/csharp

Leave a Reply