Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

properties in c#

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

   public decimal Price
   { get; set; }
}
Comment

C# Property

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
Comment

PREVIOUS NEXT
Code Example
Csharp :: find all factors of a given number 
Csharp :: c# check characters in string 
Csharp :: foreach c# linq example 
Csharp :: C# System.nanoTime 
Csharp :: how to write web service for API in c# 
Csharp :: c# remove invalid directory characters 
Csharp :: c# list string where 
Csharp :: listview thread error 
Csharp :: nunit cleanup after all tests 
Csharp :: unitry raycast 
Csharp :: dinktopdf page break 
Csharp :: int c = new int(); in C# 
Csharp :: c# Remove String In C# 
Csharp :: persian datapicker 
Csharp :: cache trong mvc 
Csharp :: c# internalsvisibleto 
Csharp :: unity datetime to string 
Csharp :: c# check port in remote pc 
Csharp :: c# lambda group by multiple columns 
Csharp :: unity2d switch camera 
Csharp :: c# trimend substring 
Csharp :: how to iterate a generic list in c# 
Csharp :: c# copy bidimensional array 
Csharp :: c# read huge file 
Csharp :: select top 5 in linq c# 
Csharp :: unity get velocity at point 
Csharp :: convert list of string to dictionary 
Csharp :: set background from C# wpf 
Csharp :: wait c# 
Csharp :: exception is null c# 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =