Dilip  Nagle

Dilip Nagle

  • 1.6k
  • 115
  • 4.3k

Complete Syntax of a NON-GENERIC Class in C# with examples

Oct 7 2023 2:51 PM

This message was sent to Shree Mahesh Chand who asked me to post it here:

On many sites including this site(my favourite site), I do not find complete syntax of a NON-GENERIC Class. I feel that it is as follow:

<Access Modifiers> class <className>(Parameters) [: BaseClass, Interfaces] 

Whereas many give examples as follows :

public class ManagerData : EmployeeData,

nobody gives and even explains as to how to use class level parameters and the need for them in real life

or how would they help a developer.

i tried to test 

public class ManagerData(int intyyyymmdd_Minbirthdate, string strEdunQuali_MinBE) : EmployeeData,

I tried it in Visual studio 2022 but it gives an error saying that this option is under preview.

Kindly guide.

Dilip Nagle


Answers (6)