Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Microsoft.VisualBasic;
- using System.Text;
- namespace CsharpCourse
- {
- internal class Student
- {
- // automatic implemented property
- public int Id { get; set; }
- public string Name { get; set; }
- // Read-only
- public string Description { get; }
- // init-only
- public int Age { get; init; }
- // Id , Name , .. -> backing fields
- /*
- public int Id
- {
- get
- {
- return Id;
- }
- set
- {
- Id = value;
- }
- }
- */
- // cto
- public Student()
- {
- Console.WriteLine("Object has been intialized!");
- }
- }
- internal class Program
- {
- static void Main(string[] args)
- {
- // built-in class
- // all classes are children to the [ object class ]
- object obj = new object();
- // object intialization
- Student s = new Student() { Id = 1 , Name ="Abeer"};
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement