Open sandboxFocus

Method Parse

Parse(string)

Parses a string containing a C# statement and returns an IStatement, which can be inserted into run-time code using InsertStatement(IStatement).

Declaration
public static IStatement Parse(string code)
Parameters
Type Name Description
string code

A string containing a single C# statement, which must end with a semicolon or closing bracket.

Returns
Type Description
IStatement

An IStatement representing the parsed statement.

Remarks

This method is useful for simple statements where the content is known as a string. For more complex or programmatically constructed statements, use StatementBuilder instead.

See Also