# C# Users: Features and Differences

## Documentation

HOOPS Envision for Desktop is written in C++ and the C# version is provided as a wrapper layer on top of this. Because of this, all documentation and tutorial snippets are provided in C++ only. As a result, all documentation and tutorial snippets are exclusively available in C++. Thanks to the strong similarities between C++ and C#, comprehending class and function descriptions as well as code examples in the C++ documentation should pose no significant challenge for C# developers.

## Namespaces

While the namespaces in C++ are quite short (`cee::ug`, `cee::vis`, …) the namespaces in the C# version have been written out with long names. The main namespace `cee`, is in C# replaced with `Ceetron.CeetronEnvision`. All namespaces under cee are renamed as follows:

- vis -> Visualization
- geo -> Geometry
- ug -> UnstructGrid
- win -> Win
- exp -> Export
- vtfx -> VTFx
- imp.cae -> ImportCae
- rep -> Report
- plt -> Plot2d

All members of the Core component are located on the root namespace `Ceetron.CeetronEnvision`. Note that the same applies to C++ where they are located directly in the `cee` namespace.

## Properties

The C# version uses properties instead of the standard set’ers and get’ers in C++. For instance, the visibility for an object is typically accessed using visible()/setVisible() in C++, while in C# it will be a property called Visible.

    // C++
    part->settings()->setVisible(true);

    // C#
    part.Settings.Visible = true;

## Inheritance

Due to limitations in the C# wrapper layer, there is a special handling of inheritance in the C# version of HOOPS Envision for Desktop. The problem is downcasting objects that are fetched from within HOOPS Envision for Desktop. For instance:

    Model model = myView.model(0);  // Get the first model (GeometryModel) from the Visualization.View instance.
    GeometryModel normalCastGeometryModel = model as GeometryModel;                 // null due to wrapper limitations
    GeometryModel ceeCastGeometryModel = GeometryModel.castFromBaseClass(model);    // Correct cast
    MarkupModel ceeCastedWrongModel = MarkupModel.castFromBaseClass(model);         // null due to wrong cast

In this scenario, we KNOW that the first model in the view is of type GeometryModel, but casting using “as” will fail and normalCastGeometryModel will be null. To work around this limitation, we have provided casting methods for all such classes. Using the static castFromBaseClass will always give you a correct cast. For an invalid cast, the returned value will be null.

This downcasting issue only applies to objects retrieved from Envision toolkits. Casting will always work for classes created and managed in your application. For instance:

    Model myModel = new GeometryModel();
    GeometryModel normalCastMyGeometryModel = myModel as GeometryModel;
    GeometryModel ceeCastMyGeometryModel = GeometryModel.castFromBaseClass(myModel);

In this case, both cast methods are valid and return the correct object of type GeometryModel.

## Deployment

For HOOPS Envision for Desktop, the development language is C++, which means that any product developed using one of our toolkits must are depending on Visual C++ redistributables. For more information on deployment of Visual C++ based applications, see Deployment in Visual C++

Using the redistributable packages is recommended because they enable automatic updates of the Visual C++ libraries. The latest Visual C++ Redistributable Packages for Visual Studio 2015-2022 can be downloaded using this permalink for the latest supported x64 version: https://aka.ms/vs/17/release/vc_redist.x64.exe

Conversation saved
HOOPSY BETA

### Hello! I'm HOOPSY

Your multilingual generative AI assistant for documentation. Ask me anything about HOOPS Envision for Desktop in your own language, or choose a sample question below to start a conversation:

What is HOOPS Envision for Desktop?
What are the latest release notes for HOOPS Envision for Desktop?
How do I start evaluating HOOPS Envision for Desktop?
How do I write my first sample application?
How can I get assistance?

HOOPSY may store conversations according to OpenAI's policy. Responses may not always be accurate.

HOOPSY is thinking...