Skip to content

Instantly share code, notes, and snippets.

@akimboyko
Created December 11, 2014 09:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akimboyko/0a50d39a1995fae526c6 to your computer and use it in GitHub Desktop.
Save akimboyko/0a50d39a1995fae526c6 to your computer and use it in GitHub Desktop.
F# decompiled pattern matching
// 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" : "?";
}
}
}
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