Posts

Showing posts from May, 2019

C# Nullable Type

Image
Description: C# provides a special data types, the  nullable type which is used to assign the null value in the variable. Suppose there is variable and there will be situation where user want to assign null value to same variable. So here system will give the exception.   To remove this drawback, c# introduces the nullable type.   Syntax : < data_type> ? <variable_name> = null; Example :

"this" Keyword

Image
Description : "this" keyword is used to represent the current instance of class. "this" keyword is used to refer current instance members. Lets we see the simple example Example : Here there is simple class "Student". "Student" class has the variable "studentName" member and method "getStudentName()." Value of member "studentName" is assigned by constructor by the "this" keyword. When object of the "Student" class , constructor is called and value is assigned in the class member "studentName" with "this" keyword. Output :