Created
December 11, 2014 09:44
-
-
Save akimboyko/0a50d39a1995fae526c6 to your computer and use it in GitHub Desktop.
F# decompiled pattern matching
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
// Decompiled with JetBrains decompiler | |
// Type: FSharpParts.FSharpParts | |
// Assembly: FSharpParts, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null | |
// MVID: 54894392-FF35-398D-A745-038392438954 | |
// Assembly location: D:\temp\SharpExperiments\FSharpParts\bin\Debug\FSharpParts.dll | |
using CSharpParts; | |
using Microsoft.FSharp.Core; | |
namespace FSharpParts | |
{ | |
[CompilationMapping(SourceConstructFlags.Module)] | |
public static class FSharpParts | |
{ | |
public static string selector(object obj) | |
{ | |
object obj1 = obj; | |
if (obj1 is ClassA) | |
return "A"; | |
if (obj1 is ClassB) | |
return "B"; | |
if (obj1 is ClassC) | |
return "C"; | |
if (obj1 is ClassD) | |
return "D"; | |
return obj1 is ClassE ? "E" : "?"; | |
} | |
} | |
} |
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
namespace FSharpParts | |
open CSharpParts | |
module FSharpParts = | |
let selector (obj: obj) = | |
match obj with | |
| :? ClassA -> "A" | |
| :? ClassB -> "B" | |
| :? ClassC -> "C" | |
| :? ClassD -> "D" | |
| :? ClassE -> "E" | |
| _ -> "?" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment