tags:

views:

100

answers:

1

I want to add a C file into my .NET application.

How can I built this? How can i write unmanaged code in C#. Can someone explain with few lines code.

Thanks

+10  A: 

You either have to build the C file into it's own DLL and then use P/Invoke in your C# code to call them or...

You could also try to port the C code to C# which would give you a completely managed codebase.

Justin Niessner
I would recommend the second option.
Alexander Rafferty
@Alexander - If the C code-base is small, then I would agree. However, I've seen some pretty monolithic C files that would be difficult to port to C#.
Justin Niessner
Or look into managed C++ /ducks and runs
Amigable Clark Kant