Last active
January 28, 2020 13:36
-
-
Save dmannock/5756e4f54cfc08de7ceac8ff5d283ad9 to your computer and use it in GitHub Desktop.
F# vs C# simple object create, read, print
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
| // store a value on an immutable object, read it and print out | |
| // F# valid program | |
| type A = { Simples: string } | |
| let a = { Simples = "this is nice" } | |
| a.Simples |> printfn "%s" | |
| // C# also does this o.O | |
| public class MoarBrackets { | |
| public readonly string Value; | |
| public MoarBrackets(string value) { | |
| Value = value; | |
| } | |
| } | |
| void Main() | |
| { | |
| var a = new MoarBrackets("fingers are bleeding"); | |
| Console.WriteLine(a); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment