Depends on Castle Dynamic Proxy 2. Returns an IEnumerable
Posted: 13 years ago by Dan Finch
Searches all (currently loaded) types using Reflection to find the types with longest and shortest names of members. Uses average length of all type member names as a metric.
13 people like thisPosted: 13 years ago by Tomas Petricek
Demonstrates how to implement the dynamic operator (?) using .NET Reflection. The implementation supports calling constructors, propreties and methods using simple overload resolution (based on parameter count). It handles instance as well as static members.
71 people like thisPosted: 13 years ago by Tomas Petricek
This code snippet enables the retrieval of the entity (Module or F# Type) in which the calling code is executing. This can be used to find the module or type name.
2 people like thisPosted: 13 years ago by Huw Simpson
Using FSharpChart control. Just call Charting.Plot() to chart series or collections of series. No need to create forms, etc.
2 people like thisPosted: 12 years ago by Boris Kogan
Any type signature has the form of a curried chain T0 -> T1 -> .... -> Tn, where Tn is not a function type. The codomain of a type is precisely Tn. This is a simple implementation that uses reflection to determine the codomain for arbitrary types.
4 people like thisPosted: 12 years ago by Eirik Tsarpalis
An example that shows how we can represent unique names (using classes) and how to substitute names in any F# type type defined using records, discriminated unions and tuples.
0 people like thisPosted: 12 years ago by Tomas Petricek
A small snippet that groups sequences of arbitrary unions by branch type.
0 people like thisPosted: 11 years ago by Eirik Tsarpalis
Implements a technique found in http://stackoverflow.com/a/2085377. Useful for rethrowing exceptions in the context of computation expressions, not otherwise possible, as well as a few other applications.
5 people like thisPosted: 11 years ago by Eirik Tsarpalis
A quick snippet showing three different ways of dynamically/reflectively locating a module then invoking a generic function. The first two don't rely on a class. But the third is more readable/understandable for most .NET devs.
5 people like thisPosted: 4 years ago by Cerberus (FSharp Discord)
This is used for building things with reflection at runtime. As ConstructorInfo arguments require typed collections, it is necessary when parsing to reflected records to first build up contents and then afterward convert the collected obj[] to a 'a[]. This is finally cast back to obj so it can be used as a ConstructorInfo argument.
29 people like thisPosted: 13 years ago by Rick Minerich
The snippet shows a simple implementation of the dynamic operator (?) that uses Dynamic Language Runtime and the C# implementation of dynamic operations. The snippet shows how to invoke instance methods with single argument.
34 people like thisPosted: 13 years ago by Tomas Petricek
Tennis scoring system (at the game level). Includes some pattern-matching examples including 'when' guards.
4 people like thisPosted: 13 years ago by Kit Eason
Sometimes it is extremely useful to check some calculations with Excel. The snippet shows how F# expressions can be transformed into Excel formulae. The data is exported together with the formulae, e.g. a, b and sum function as input sets A1's value to a, B1's to b and C1's formula to "=$A$1+$B$1"
17 people like thisPosted: 12 years ago by Natallie Baikevich
reflection, not exactly efficient but good canvas to start exploring
5 people like thisPosted: 12 years ago by David Klein
A simple script to list the exceptions that can be thrown during the method invocation (both caught and uncaught).
5 people like thisPosted: 12 years ago by Natallie Baikevich
got distracted and decided I wanted to be able to 'disassemble' a function inside of FSI, much like you can do in many Lisps, this isnt very complete and I think it will only work on the most basic functions, but it was very challenging to get working so I thought I would paste it.
4 people like thisPosted: 12 years ago by David Klein
Implemetation picked up from http://msdn.microsoft.com/en-us/library/system.runtime.serialization.objectmanager.aspx
3 people like thisPosted: 11 years ago by Eirik Tsarpalis
Get/put field/property and invoke method (one and multi arguments) via "?" operator.
3 people like thisPosted: 10 years ago by Zhukoff Dima