This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Test = | |
static member EchoExpression([<ReflectedDefinition(true)>] x : Expr<_>) = | |
let expression, value = (* decompose AST of x *) | |
printfn "%s evaluates to %O" expression value | |
let x, y, z = 42, 89.0, 92.5 | |
Test.EchoExpression(x) // "x evaluates to 42" | |
Test.EchExpression(Math.Max(y, z)) // "Math.Max(y, z) evaluates to 92.5" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public MainWindow() | |
{ | |
InitializeComponent(); | |
Loaded += async (o, e) => { | |
await Task.Delay(1000); | |
_strings = new string[] { "EnC now supports more features!", "Thanks to Roslyn!"}; | |
label.Content = (from str in _strings | |
where str.StartsWith("Enc") | |
select str).FirstOrDefault(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using static System.Console; | |
using static System.Math; | |
using static System.DayOfWeek; | |
class Program | |
{ | |
static void Main() | |
{ | |
WriteLine(Sqrt(3 * 3 + 4 * 4)); | |
WriteLine(Friday - Monday); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Imports System.Console | |
Imports System.Math | |
Imports System.DateOfWeek | |
Module Program | |
Sub Main() | |
WriteLine(Sqrt(3 * 3 + 4 * 4)) | |
WriteLine(Friday - Monday) | |
End Sub | |
End Module |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dim s = "Write your haiku with | |
No vbCrLf | |
In VB14" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var s = @"Write your haiku with | |
No \r\n escapes | |
In C# v1"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Public Class Customer | |
Public ReadOnly Property First As String = "Jane" | |
Public ReadOnly Property Last As String = "Doe" | |
End Class |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var s = $"{p.Name} is {p.Age} year{{s}} old"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dim s = $"{p.Name} is {p.Age} year{{s}} old" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int length = customers?.Length ?? 0; // 0 if customers is null |