# Expression class

Namespace: [Grasshopper2.Expressions](https://developer.rhino3d.com/api/gh2/namespace/grasshopper2.expressions.md) · Assembly: [Grasshopper2](https://developer.rhino3d.com/api/gh2/assembly/grasshopper2.md)

```cs
[IoId("00000000-1369-45e5-9517-944544f770d8")]
public sealed class Expression : IStorable
```

Represents an expression for a specific input output type.

## Constructors

- [Expression](https://developer.rhino3d.com/api/gh2/type/grasshopper2.expressions.expression/ctor.md)

## Properties

- [CompilerCode](https://developer.rhino3d.com/api/gh2/type/grasshopper2.expressions.expression/compilercode.md): Gets the modified source code that was used to compile this expression.
- [Identity](https://developer.rhino3d.com/api/gh2/type/grasshopper2.expressions.expression/identity.md): (static) Gets an identity expression for a single variable 'x'.
- [NaN](https://developer.rhino3d.com/api/gh2/type/grasshopper2.expressions.expression/nan.md): (static) Gets an expression which always returns double.NaN.
- [Undeclareds](https://developer.rhino3d.com/api/gh2/type/grasshopper2.expressions.expression/undeclareds.md): Iterate over all global variables in this expression. This expression probably cannot be evaluated unless a Resolver is supplied which provides values for all these globals.
- [UserCode](https://developer.rhino3d.com/api/gh2/type/grasshopper2.expressions.expression/usercode.md): Gets the source code with which this expression is associated.
- [Zero](https://developer.rhino3d.com/api/gh2/type/grasshopper2.expressions.expression/zero.md): (static) Gets an expression which immediately returns zero.

## Methods

- [Constant](https://developer.rhino3d.com/api/gh2/type/grasshopper2.expressions.expression/constant.md): (static) Create an expression with a constant return value.
- [Evaluate](https://developer.rhino3d.com/api/gh2/type/grasshopper2.expressions.expression/evaluate.md): (2 overloads) Evaluate this expression. If the expression relies on external variables, you cannot use this overload.
- [EvaluateSafe](https://developer.rhino3d.com/api/gh2/type/grasshopper2.expressions.expression/evaluatesafe.md): (2 overloads) Evaluate this expression. Any exceptions thrown during evaluation will be returned as a string instead.
- [GetHashCode](https://developer.rhino3d.com/api/gh2/type/grasshopper2.expressions.expression/gethashcode.md): Gets a hash for this expression.
- [IStorable.Store](https://developer.rhino3d.com/api/gh2/type/grasshopper2.expressions.expression/grasshopperio-istorable-store.md)
- [HasUndeclareds](https://developer.rhino3d.com/api/gh2/type/grasshopper2.expressions.expression/hasundeclareds.md): Test whether this expression has any undeclareds other than the provided list.
- [ToString](https://developer.rhino3d.com/api/gh2/type/grasshopper2.expressions.expression/tostring.md): Gets a string description of this expression.
- [TryCreate](https://developer.rhino3d.com/api/gh2/type/grasshopper2.expressions.expression/trycreate.md): (2 overloads, static) Try and create an expression. This method doesn't throw.
- [Variable](https://developer.rhino3d.com/api/gh2/type/grasshopper2.expressions.expression/variable.md): (static) Create an expression with a direct variable lookup.
