Navigation

Related Articles

Back to Latest Articles

C# Basics – Constructors – Part 12

We explore how constructors work and for what we might need to use them.


Andraz Krzisnik
C# Basics – Constructors – Part...

Constructors

Sometimes we want to create an object and set some predetermined state to it. Basically, you would pass the properties’ values as an argument to an object when you are creating it. Whenever we are creating a constructor, there is something important to keep in mind, we need to set it’s name exactly the same as the name of the class it’s in.

We also can’t call it just anywhere like functions. We can only call a constructor with a new keyword in the beginning.


And when we would use it, we’d write:

Download Examples Next Chapter
Show Comments (0)

Comments

Related Articles

C# Tutorial

C# Tutorial: How To Create Image Zero Padding

Zero padding an image is useful when we’re convolving it with a filter of certain size. How much padding should we use depends on how big our filter is. What is the purpose...

Posted on by Andraz Krzisnik
C# Tutorial

C# Tutorial: How To Create Gaussian Blur

Gaussian blur is an image processing operation, that reduces noise in images. It does so by a convolution process, using a matrix that contains values calculated by a Gaussian...

Posted on by Andraz Krzisnik