# C# bindings

The GDAL project (primarily Tamas Szekeres) maintains SWIG generated C# bindings for GDAL and OGR.

Generally speaking the classes and methods mostly match those of the GDAL and OGR C++ classes, but there is currently no C# specific documentation beyond this site.

The C# bindings are also usable from other .NET languages, such as VB.Net.

The C# interface has been built upon the same libraries as the other SWIG generated wrappers (like Python, Java). Therefore, the class names, class member names, and the method signatures are driven by the GDAL+SWIG conventions and might not follow the conventional .NET naming guidelines. However, one can easily identify the matching members in the GDAL/OGR API documentation.

The GDAL/OGR C# classes use the .NET P/Invoke mechanism for the communication between the managed and unmanaged code. Every class implements the IDisposable interface to control the finalization of the underlying unmanaged memory referenced by every the wrapper class.

## Supported platforms

Currently the interface is compilable on and supports:

- the various Win32 and Win64 platforms targeting the Microsoft.NET and the MONO frameworks,

- GNU Linux/OSX systems using the MONO framework, and

- Unity systems on Windows, OSX and Linux (currently only the MONO framework and not IL2CPP).

## Getting GDAL for C#

There are a number of ways to get the C# bindings, including but not limited to:

- The gisinternals site, see below under "Windows Build SDK",

- The Conda package, see instructions below

- The gdal.netcore NuGet package, see link below, and

- For Unity, there is a UPM package that installs GDAL, available from here (available on Windows, Mac and Linux)

(all of these are community supported)

## Related Documents

> - Compiling the C# bindings - Legacy Scripts
> - Compiling the C# bindings - CMake Scripts
> - C# Raster Interface
> - C# Vector and Spatial Reference Interfaces
> - C# Bindings Usage Advice
> - C# Bindings Conda Package

## Useful Links

- A variety of example programs in CSharp are available at the /swig/csharp/apps folder of the GDAL project tree.

- The Conda Feedstock

- A simple (as is) build engine of GDAL 3.2 library for .NET Core. MaxRev-Dev/gdal.netcore

- The ViRGiS project makes extensive use of GDAL in c# in a Unity environment.

(Please add your project to this section)

## Windows Build SDKs

Tamas Szekeres maintains build SDK packages in order to compile GDAL from the sources on Windows. The build system provides daily build binary packages for the latest stable and development versions.