# Using C# classes in Xojo

**URL:** <https://forum.xojo.com/t/using-c-classes-in-xojo/12630>\
**Category:** Getting Started\
**Created:** [November 27, 2013, 11:50am UTC](https://forum.xojo.com/t/using-c-classes-in-xojo/12630 "2013-11-27T11:50:56Z")\
**Posts on this page:** 1\
**Showing post:** 34

<div class="post-metadata">

**Author:** ![Finance\_Dept](https://forum.xojo.com/letter_avatar_proxy/v4/letter/f/c5a1d2/32.png) [@Finance\_Dept](https://forum.xojo.com/u/Finance_Dept)\
**Post date:** [December 14, 2013, 9:23pm UTC](https://forum.xojo.com/t/using-c-classes-in-xojo/12630/34 "2013-12-14T21:23:24Z")

</div>

I’ve been able to get this working using the Unmanaged Exports – which is HUGE for folks who need to create DLL’s and want to take advantage of .NET and the whole C# ecosystem.

This avoids the whole COM-Visible and COM-interop nightmare which can slow down a project, and also complicate things.

“Unmanaged Exports” a C# class library package by [Robert Giesecke](https://sites.google.com/site/robertgiesecke/Home/uploads/unmanagedexports#TOC-C-:).

No more ActiveX wrapper! Excellent stuff!

Here’s what you do:

1. Get the NuGet packages for VS 2010 or better, install them in your VS 2012 system.
2. Create a VS C# Class Library Project
3. When you create a method make sure its “static”, and that you decorate it with [DllExport]
4. Compile the project, place the DLL in the runtime location of your Xojo project or make sure the Declare has a direct path  
to that DLL
5. Voila! .NET DLL access from Xojo… no ActiveX wrapper, no COM-Interop.

Below is a code snippet.

C#

```auto
using System;
using RGiesecke.DllExport;
using System.Runtime.InteropServices;

public class TestExport
{
 
    [DllExport]
    public static int Test(string TestString)
    {
        return TestString;
    }
}
```

```auto
Declare Function Test lib "TestExport.dll" (msg as CString) AS String
 
 Msg ( Test ("Hello, .NET Class Library DLL!"))

```

---

_[View the full topic](https://forum.xojo.com/t/using-c-classes-in-xojo/12630)._
