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.
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
- Use git to clone the OCI SDK for .NET repository:
git clone https://github.com/oracle/oci-dotnet-sdk.git
- Create a configuration file in your home directory (
~/.oci/config
). See SDK and CLI Configuration File for more information. - Change directory into the .NET Examples folder. For example:
cd ./oci-dotnet-sdk/Examples/
-
All of the examples require the environment variable
OCI_COMPARTMENT_ID
populated with the tenant ID or compartment ID. -
From the command line, run
dotnet run
. The Audit example runs by default. -
To run any other example, make sure it has a
Main()
function.