# Interoperability with .NET

**URL:** <https://discourse.julialang.org/t/interoperability-with-net/19611>\
**Category:** General Usage\
**Tags:** dotnet, interoperability\
**Created:** [January 14, 2019, 11:09am UTC](https://discourse.julialang.org/t/interoperability-with-net/19611 "2019-01-14T11:09:22Z")\
**Posts on this page:** 1\
**Showing post:** 21

<div class="post-metadata">

**Author:** ![HyperSphereStudio](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hyperspherestudio/32/32322_2.png) [@HyperSphereStudio](https://discourse.julialang.org/u/HyperSphereStudio)\
**Post date:** [January 11, 2022, 5:43am UTC](https://discourse.julialang.org/t/interoperability-with-net/19611/21 "2022-01-11T05:43:50Z")

</div>

Note: Repost to give greater detail

Here is my library on Julia & .NET Interoperability: [GitHub - HyperSphereStudio/JULIAdotNET](https://github.com/HyperSphereStudio/JULIA.Net)

It uses the C-Interface of both languages to translate between the languages very quickly compared to normal server/client based systems.

```julia
 Julia.Init();
  JLFun fun = Julia.Eval("t(x) = sqrt(x)");
  double result = (double) fun.Invoke(2);
  object dotNetObject = fun.Invoke(3).Value;
  Julia.Exit(0);  

```

It is very new but it has support for various built in Julia features such as a JLArray to allow manipulating jl\_arrays neatly.

You can also work with .NET from Julia (Experimental at the moment). It utilizes .NET reflection

In C#:

```nohighlight
public class TestClass{
    public long g;
    public TestClass(long g) => this.g = g;
}

```

Working from Julia:

```julia
sharpType = SharpType("TestClass") #Retrieve Type
sharpCon = SharpConstructor(sharpType, 0) #Get Constructor at Index 0
o = sharpCon(6) #Create Instance
sharpField = SharpField(sharpType, "g") #Get Field
println(sharpField(o)) #Get Field Value

```

---

_[View the full topic](https://discourse.julialang.org/t/interoperability-with-net/19611)._
