Skip to content

C# Types Management

Coding Seb edited this page Jan 18, 2019 · 10 revisions

Primary types

ExpressionEvaluator manage the following list of C# primary types

  • object
  • string
  • bool/bool?
  • byte/byte?
  • char/char?
  • decimal/decimal?
  • double/double?
  • short/short?
  • int/int?
  • long/long?
  • sbyte/sbyte?
  • float/float?
  • ushort/ushort?
  • uint/uint?
  • ulong/ulong?
  • void

Add the ? for nullable types

Assemblies, Namespaces and types

To resolve types and namespaces ExpressionEvaluator search in in assemblies loaded in the evaluator.Assemblies list. By default this list Contains all loaded assemblies in the current AppDomain when the constructor of ExpressionEvaluator is called. You can easily Clear, Add or Remove assemblies on this list.

By default the following list of namespaces are available :

  • System
  • System.Linq
  • System.IO
  • System.Text
  • System.Text.RegularExpressions
  • System.ComponentModel
  • System.Dynamic
  • System.Collections
  • System.Collections.Generic
  • System.Collections.Specialized
  • System.Globalization

You can extend or reduce this list :

ExpressionEvaluator evaluator = new ExpressionEvaluator();
evaluator.Namespaces.Add(namespace);
evaluator.Namespaces.Remove(namespaceToRemove);

All types defined in these namespaces are accessibles.

You can also add a specific type :

evaluator.Types.Add(typeof(MyClass));

Table Of Content

Clone this wiki locally