Learn C#: Classes and Objects
Define your own custom types using classes.
StartKey Concepts
Review core concepts you need to learn to master this subject
C# Classes
C# Constructor
C# Parameterless Constructor
C# Access Modifiers
C# Field
C# this Keyword
C# Members
C# Dot Notation
C# Classes
C# Classes
using System;
namespace BasicClasses
{
class Forest {
public string name;
public int trees;
}
}
// Here we have the Forest class which has two pieces of data, called fields. They are the "name" and "trees" fields.
In C#, classes are used to create custom types. The class defines the kinds of information and methods included in a custom type.
Basic Classes and Objects
Lesson 1 of 2
What you'll create
Portfolio projects that showcase your new skills
How you'll master it
Stress-test your knowledge with quizzes that help commit syntax to memory