summaryrefslogtreecommitdiff
path: root/test/syntax/source/code/csharp
blob: f58190a14e48ad06658306495915c2f6e70a3c1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;

#pragma warning disable 414, 3021

public class Program
{
    /// <summary>The entry point to the program.</summary>
    public static int Main(string[] args)
    {
        Console.WriteLine("Hello, World!");
        string s = @"This
""string""
spans
multiple
lines!";

        dynamic x = new ExpandoObject();
        x.MyProperty = 2;

        return 0;
    }
}

async Task<int> AccessTheWebAsync()
{
    // ...
    string urlContents = await getStringTask;
    return urlContents.Length;
}

internal static void ExceptionFilters()
{
  try 
  {
      throw new Exception();
  }
  catch (Exception e) when (e.Message == "My error") { }
}