RegionRepository.Delete Method

Delete existing region. All child regions in tree are deleted too.

Namespace: Gamanet.C4.SDK
Assembly: Gamanet.C4.SimpleClient (in Gamanet.C4.SimpleClient.dll) Version: 2026.0.0.733
Syntax
C#
public void Delete(
	SimpleRegionV1 region
)

Parameters

region  SimpleRegionV1
The region.

Implements

ISimpleClientRegionRepositoryV1.Delete(SimpleRegionV1)
Example
The following example illustrates how the SimpleClient deletes the region.
C#
using System;
using Gamanet.C4.SDK;
using Gamanet.C4.SimpleInterfaces;

public class Example
{
    static void Main()
    {
        // Create instance of simple client
        var client = new SimpleClient(ConnectorConfiguration.HttpClient);

        ConnectionInfoV1 token;
        // Connect to local server
        var connectionResult = client.Connect(new Uri("https://localhost/"), "Support", "support", out token);

        if (connectionResult != ConnectionResult.Successful)
        {
            Console.WriteLine("Connection unsuccessful, result: {0}", connectionResult);
            return;
        }

        Console.WriteLine("Connection result: {0}", connectionResult);
        Console.WriteLine();

        // Delete existing region. All child regions in tree are deleted too.
        // Create Example Region
        var exampleRegion = new SimpleRegionV1(
            Guid.NewGuid(),
            "ExampleRegion",
            EntityRoot.Region,
            RegionCategory.Region
            );
        // Create Example Region in database
        client.Regions.Create(exampleRegion);

        // check wheter the region was created
        var createdRegion = client.Regions.Get(exampleRegion.Id, Properties.All);
        Console.WriteLine(createdRegion.Name);

        // Delete the example region
        client.Regions.Delete(exampleRegion);
        var deletedRegion = client.Regions.Get(exampleRegion.Id, Properties.All);

        if(deletedRegion == null)
        {
            Console.WriteLine("Example region was deleted");
        }

        // Disconnect from server
        client.Disconnect();
    }
}
See Also

Reference

RegionRepository Class
Gamanet.C4.SDK Namespace
SimpleRegionV1