
Define a class in C# and create an instance of the class Part 2 – Create a new class
Write click on the solution and create a new class and name the class file
Person.cs

Set the access modifier to public.
public class Person
{
}
Create an auto-implemented read only property.
public string Name { get; }
Next add a constructor that takes one argument.
public Person(string name)
{
Name = name;
}
Now in the next post we’ll instantiate two instances of our Person class.