If you want to evaluate a string expression use the below code snippet.
using System.Data;
DataTable dt = new DataTable();
var v = dt.Compute("3 * (2+4)","");
More Related Contents:
- Evaluate string with math operators [duplicate]
- What is the difference between String and string in C#?
- In C#, why is String a reference type that behaves like a value type?
- C# string reference type?
- Is double Multiplication Broken in .NET? [duplicate]
- Converting dd/mm/yyyy formatted string to Datetime [duplicate]
- How can I transform string to UTF-8 in C#?
- string = string + int: What’s behind the scenes?
- Check if a value is in an array (C#)
- Get host domain from URL?
- Fixed point math in C#
- Checking if a string array contains a value, and if so, getting its position
- How to know the size of the string in bytes?
- IEnumerable to string [duplicate]
- Format a string into columns
- String to Binary in C#
- ComboBox.SelectedText doesn’t give me the SelectedText
- Top level domain from URL in C#
- Check if a string is a palindrome
- Instantiate a class from its textual name
- C# how convert large HEX string to binary
- Why does .ToString() on a null string cause a null error, when .ToString() works fine on a nullable int with null value?
- Creating a Math library using Generics in C#
- Converting String To Float in C#
- Does String.GetHashCode consider the full string or only part of it?
- Detecting if a string is all CAPS
- Algorithm for Calculating Binomial Coefficient
- Replace non-numeric with empty string
- Parsing formatted string
- How to get the first five character of a String