Saturday, April 26, 2025

C# OO - Automatic Properties - { get; set; }

using System;

namespace LearnCS
{
    class Storage {
        public string someString
        { get; set; }
       
        public int someNumber 
        { get; set; }
    }
   
    class Program
    {
        static void Main(string[] args)
        {
            Storage p1 = new Storage();

            p1.someString = "New Value";
            Console.WriteLine(p1.someString);

            Storage p2 = new Storage();
            p2.someNumber = 654546;
            Console.WriteLine(p2.someNumber);

            Console.ReadLine();
        }
    }
}

No comments:

Post a Comment

Tkinter Introduction - Top Widget, Method, Button

First, let's make shure that our tkinter module is working ok with simple  for loop that will spawn 5 instances of blank Tk window .  ...