Skip to content

Commit bed8ee3

Browse files
authored
Update README.md
1 parent d6342aa commit bed8ee3

File tree

1 file changed

+40
-7
lines changed

1 file changed

+40
-7
lines changed

README.md

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,45 @@ ex1?Test<-"Hi"//Set Dynamic Property
3838
ex1?Test //Get Dynamic
3939
```
4040

41-
### SignalR
41+
### MVC ViewBag
42+
43+
```fsharp
44+
x.ViewBag?Name<-"George"
45+
```
46+
47+
### Dynamitey
48+
49+
```fsharp
50+
open FSharp.Interop.Dynamic
51+
open Dynamitey.DynamicObjects
52+
53+
let ComBinder = LateType("System.Dynamic.ComBinder, System.Dynamic, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
54+
55+
let getPropertyNames (target:obj) =
56+
seq {
57+
yield! target.GetType().GetTypeInfo().GetProperties().Select(fun it -> it.Name)
58+
if (ComBinder.IsAvailable) then
59+
yield! ComBinder?GetDynamicDataMemberNames(target)
60+
}
61+
62+
```
63+
64+
65+
### Python Interop
66+
```fsharp
67+
open Python.Runtime
68+
open FSharp.Interop.Dynamic
69+
open FSharp.Interop.Dynamic.Operators
70+
do
71+
use __ = Py.GIL()
72+
let math = Py.Import(“math”)
73+
math?cos(math?pi ?*? 2) |> printfn “%O”
74+
let sin = math?sin
75+
sin 5 |> printfn “%O”
76+
math?cos(5) ?+? sin(5) |> printfn “%O”
77+
```
78+
79+
### SignalR (.net framework version)
4280

4381
```fsharp
4482
open FSharp.Interop.Dynamic
@@ -47,17 +85,12 @@ type MyHub =
4785
member x.Send (name : string) (message : string) =
4886
base.Clients.All?addMessage(name,message) |> ignore
4987
```
50-
### MVC ViewBag
51-
52-
```fsharp
53-
x.ViewBag?Name<-"George"
54-
```
5588

5689
# Caveats:
5790

5891
The `DLR` is incompatible with interface explicit members, so are these operators, [just like C#'s `dynamic` keyword](http://stackoverflow.com/questions/22514892/iterate-through-a-dictionary-inserted-in-a-asp-net-mvc4-pages-viewdata-via-f-c).
5992

60-
[.NET Core 2.0.0 to 2.0.2 had a major bug in the C# dynamic keyword with nested classes inside of generic classes.](https://github.com/fsprojects/FSharp.Interop.Dynamic/issues/11). You will know it from a substring argument length exception. .NET Framework 4.0+, .NET Core 1.x and .NET Core 2.0.3+ are unaffected.
93+
[.NET Core 2.0.0 to 2.0.2 had a major bug in the C# dynamic keyword with nested classes inside of generic classes.](https://github.com/fsprojects/FSharp.Interop.Dynamic/issues/11). You will know it from a substring argument length exception. .NET Framework 4.0+, .NET Core 1.x and .NET Core 2.0.3+ and later are unaffected.
6194

6295
## Maintainer(s)
6396

0 commit comments

Comments
 (0)