Horje
C# Property  default value Code Example
C# Property default value
using System;

class Medication
{
    public int Quantity { get; set; } = 30; // Has default value.
}

class Program
{
    static void Main()
    {
        Medication med = new Medication();
        // The quantity is by default 30.
        Console.WriteLine(med.Quantity);
        // We can change the quantity.
        med.Quantity *= 2;
        Console.WriteLine(med.Quantity);
    }
}
30
60




Csharp

Related
unity how to destroy child Code Example unity how to destroy child Code Example
How to create a gameobject by code Code Example How to create a gameobject by code Code Example
c# write line variable Code Example c# write line variable Code Example
How to print text to screen in c# Code Example How to print text to screen in c# Code Example
Alll select options unselectable Code Example Alll select options unselectable Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
10