using System;
public class HelloWorld
{
class Octopus {
string name;
public int Age = 10;
int Foo (int x) { return x * 2; }
}
public class Stock0
{
public decimal CurrentPrice
{
get { return currentPrice; }
set { currentPrice = value; }
}
}
class Rectangle
{
public readonly float Width, Height;
public Rectangle (float width, float height)
{
Width = width;
Height = height;
}
public void Deconstruct (out float width, out float height)
{
width = Width;
height = Height;
}
}
public class Asset
{
public string Name;
public abstract decimal NetValue { get; }
public virtual decimal Liability => 0;
}
public class Stock : Asset
{
public long SharesOwned;
public decimal CurrentPrice;
public override decimal NetValue => CurrentPrice * SharesOwned;
}
public class House : Asset
{
public decimal Mortgage;
public override decimal Liability => Mortgage;
}
public static void Display (Asset asset)
{
System.Console.WriteLine (asset.Name);
}
delegate int Transformer (int x);
static int Square (int x) => x * x;
public static void Main()
{
var rect = new Rectangle (3, 4);
(float width, float height) = rect;
Console.WriteLine (width + " " + height);
Stock msft = new Stock { Name="MSFT",
SharesOwned=1000 };
Console.WriteLine (msft.Name);
Console.WriteLine (msft.SharesOwned);
House mansion = new House { Name="Mansion",
Mortgage=250000 };
Console.WriteLine (mansion.Name);
Console.WriteLine (mansion.Mortgage);
Display(msft)
Display(mansion)
Asset a = msft;
Stock s = (Stock)a;
Transformer t = Square;
int answer = t(3);
}
}