---
title: "Csharp .Net 5"
slug: "csharp-net-5"
updated: 2024-09-10T21:26:37Z
published: 2024-09-10T21:26:37Z
canonical: "docs.skillable.com/csharp-net-5"
---

> ## Documentation Index
> Fetch the complete documentation index at: https://docs.skillable.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Csharp .Net 5

Skillable Studio allows execution of scripts against a cloud subscription, as well as executing scripts that do not have a target. Scripts are used in Automated Activities and Life Cycle Actions.

## Using Directives

C# scripts in Skillable Studio can use the `Using` directive at the beginning of a script, to help simplify your code.

```plaintext
//To allow the use of types in a namespace so that you do not have to qualify the use of a type in that namespace:
using System.Text;
```

```plaintext
//To allow you to access static members and nested types of a type without having to qualify the access with the type name.
using static System.Math;
```

```plaintext
//To create an alias for a namespace or a type. This is called a using alias directive.
using Project = PC.MyCompany.Project;
```

## Interacting with Skillable Studio

Your scripts can communicate success or failure to Skillable Studio in one of two ways.

### Return a Boolean value

```plaintext
//do stuff... all good
return true;
```

```plaintext
//do stuff... uh oh
return false;
```

### Use setActivityResult

```plaintext
//do stuff... all good
#Set-ActivityResult -Correct -Message 'Nice job'
```

```plaintext
//do stuff... uh oh
#Set-ActivityResult -Incorrect -Message 'Please try again'
```

You can also report the result as a score percentage...

```plaintext
//do stuff... we want to report success and set the score value as 50%
Set-ActivityResult -Percentage .5 -Message "You received half credit"
```

### Send a Notification to the User

Notifications appear as real-time toast notification in the lab client.

```plaintext
Send-LabNotification 'Hello from Azure CLI'
```

### Lab Variables

Lab variables are always string name/value pairs. Variable values are scoped to the lab instances and become available within the lab instructions as well as subsequent script executions.

```plaintext
Set-LabVariable -Name 'firstName' -Value 'John'
```

You can "receive" a variable in your script...

```plaintext
#a variable set elsewhere in the lab, but we can use it in our script
var myVariable1 = "@lab.Variable(myVariable1)";
```
