Comments on: Data Types, Declarations and Variable Definitions in C# https://code-maze.com/csharp-data-types-variables/ Learn. Code. Succeed. Wed, 01 Mar 2023 20:20:27 +0000 hourly 1 https://wordpress.org/?v=6.7.5 By: Marinko Spasojević https://code-maze.com/csharp-data-types-variables/#comment-7615 Wed, 01 Mar 2023 20:20:27 +0000 https://code-maze.com/?p=4150#comment-7615 In reply to Ashish Arya.

This is just an example of adding a value to (instantiating) a reference type. So, we didn’t show that class as we are not working with classes yet. But you can imagine something like this:

public class Studend
{
  public string Name { get; set; }

  public int Age { get; set; }

  public Studend(string name, int age)
  {
    Name = name;
    Age = age;
  }
}
]]>
By: Ashish Arya https://code-maze.com/csharp-data-types-variables/#comment-7614 Wed, 01 Mar 2023 19:43:14 +0000 https://code-maze.com/?p=4150#comment-7614 In line where you have Student with new operator and passing those values (name and age).
I donot see any constructor declared where you have set those values.

Can you explain about this please.

Regards,
Ashish Arta

]]>