Examples

This topic describes how to find, download, and run OCI .NET SDK examples.

GitHub

Examples of SDK usage can be found on GitHub, including:

The examples are also in the downloadable .zip file for the SDK. Examples for older versions of the SDK are in the downloadable .zip for the specific version, available on GitHub.

If you'd like to see another example not already covered, file a GitHub issue.

SDK Reference

In addition to the examples found on GitHub, the SDK for .NET API reference contains code examples that you can copy and modify to run in your own environment.

Running Examples

  1. Use git to clone the OCI SDK for .NET repository: git clone https://github.com/oracle/oci-dotnet-sdk.git
  2. Create a configuration file in your home directory (~/.oci/config). See SDK and CLI Configuration File for more information.
  3. Change directory into the .NET Examples folder. For example: cd ./oci-dotnet-sdk/Examples/
  4. All of the examples require the environment variable OCI_COMPARTMENT_ID populated with the tenant ID or compartment ID.

  5. From the command line, run dotnet run . The Audit example runs by default.

  6. To run any other example, make sure it has a Main() function.

Was this article helpful?