This file contains 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
open FSharp.Data | |
open FSharp.Data.JsonExtensions | |
open System.IO | |
open System | |
module City = | |
type T = City of string | |
let Kyiv = City "Киев" | |
let Kharkiv = City "Харьков" |
This file contains 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
[System.Runtime.InteropServices.DllImport("KERNEL32.DLL")] | |
private static extern int GetSystemDefaultLCID(); | |
private RegionInfo CurrentRegionInfo() | |
{ | |
var cultureInfo = new CultureInfo(GetSystemDefaultLCID()); | |
return new RegionInfo(cultureInfo); | |
} | |
// OR (it's preferable if Vista or higher) |
This file contains 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 static class RxExamples | |
{ | |
// Equal to Observable.Empty<T>() | |
public static IObservable<T> Empty<T>() | |
{ | |
return Observable.Create<T>(observer => | |
{ | |
observer.OnCompleted(); | |
return Disposable.Empty; | |
}); |
This file contains 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
static void Main() | |
{ | |
IObservable<int> observable = Enumerable.Range(0, 10).ToObservable(); | |
// Long version | |
observable.Subscribe(new IntObserver()); | |
// Short version (lambda) | |
observable.Subscribe(Console.WriteLine) | |
NewerOlder