c# class syntax code example
Example 1: c# class declaration
//[access modifier] - [class] - [identifier]
public class Customer
{
// Fields, properties, methods and events go here...
}
Example 2: c# classes
using System;
class Book
{
public string title;
public string author;
public int pages;
}
class MainClass {
public static void Main (string[] args) {
Book book1 = new Book();
book1.title = "Harry Potter";
book1.author = "JK Rowling";
book1.pages = 400;
Console.WriteLine(book1.title);
}
}