-
Notifications
You must be signed in to change notification settings - Fork 0
History
Kota edited this page Feb 14, 2019
·
8 revisions
- Hello, World!
- Generic
- cs => cs.Linq
- dynamic
- async
- Auto Property Initializer
public Guid Id { get; } = Guid.NewGuid();
- Primary Constructor
public class Money(string currency, decimal amount)
{
public string Currency { get; } = currency;
public string Amount { get; } = amount;
}
- using Static Typename
using System.Console;
class Program
{
public static void Main()
{
WriteLine("Hello World!");
}
}
- Dictionary Initializers
var _users = new Dictionary<string, string>() {
["admin"] = "Ram",
["guest"] = "Sham"
}
// earlier
var _users = new Dictionary<string, string>() {
{ "admin", "Ram" },
{ "guest", "Sham" }
}
- Event Initializer : Wiring up an event while creating the object
- Numeric Literals
public byte Code { get; } = 0b1100;
public long Length { get; } = 1_000_000_000;
- Declaration Expression
foreach (var n in var odd = numbers(n +. n %2 == 1).ToList())
{
}
// old
var amount = 0;
decimal.TryParse("10.0", out amount);
// new
decimal.TryParse("10.0", var out amount);
- Await in Catch block
- Rosyln : .Net Compiler -> Open Source