0

I am wondering if anyone can help me. I am trying to add an SQLite database to an Gtk# application using monodevelop. I want to reference a different library depending on what version of OS is is used. I am unsure how to detect if it is linux or not or if this is possible.

#if (linux)
    using SqliteConnection = Mono.Data.Sqlite.SqliteCommand;
    using SqlCommand = Mono.Data.Sqlite.SqliteCommand;
#else
    using SqliteConnection = System.Data.SQLite.SQLiteConnection;
    using SqliteCommand = System.Data.SQLite.SQLiteCommand;
#endif
Jimbo Jones
  • 983
  • 4
  • 13
  • 48
  • It was a typo sorry – Jimbo Jones Jun 05 '18 at 12:23
  • Possible duplicate of [How to use custom preprocessor directives in .Net Core](https://stackoverflow.com/questions/43743808/how-to-use-custom-preprocessor-directives-in-net-core) – DavidG Jun 05 '18 at 12:27
  • Note that what you are writing will change the code at **compile** time. You'll have two exe, one for Windows and one for Linux. – xanatos Jun 05 '18 at 12:35
  • check this out: https://stackoverflow.com/questions/38790802/determine-operating-system-in-net-core – MUG4N Jun 05 '18 at 18:40

0 Answers0