xFactorSchool.com(Beta)
How to Do Examples
Python Examples
HTML Examples
Code Examples
C Code Examples
C++ Code Examples
C# Code Examples
Java Code Examples
Python Code Examples
HTML Code Examples
CSS Code Examples
JavaScript Code Examples
Online Editor
C Code Editor
C++ Code Editor
C# Code Editor
Java Code Editor
Python Code Editor
HTML Code Editor
CSS Code Editor
JavaScript Code Editor
Practice how to create a class constructor with parameters in C#
C# Online Editor
Execute Code
More C# Sample Code
using System; namespace ExampleApp { class Program { static void Main(string[] args) { //parameter values are passed at the time of class instantiation(object declaration) Person personObj = new Person("John", 25); Console.WriteLine(personObj.Name + " is " + personObj.Age + " years old."); } } // This is a class class Person { // class fields public string Name; public int Age; //This is class constructor public Person(string name, int age) //name and age are parameters { Name = name; Age = age; } } }