The most basic expression consists of an operator,two operands and an assignment.
Example
The following is an example of an expression:
[csharp]
int result = 3 + 2;
where + is Operator and
3,2 are Operands
[/csharp]
More Info
Expressions in C# can use operators that in turn use other expressions such as parameters or method calls. The parameters that are used in turn uses other method calls. So,expressions can range from elementary to very complex.
Regular Expression
Lambda Expression
Example
Following are two examples of expressions:
1.((x 4)) || ((x > 25) && (x < 30))
2.System.Convert.ToInt32("10")
Regular Expression
Description
A regular expression, is a special text string for describing a search pattern. Fundamentally, a regular expression is a pattern describing a certain amount of text. Their name comes from the mathematical theory on which they are founded. The regular expression is abbreviated to regex or regexp. Regex is the most commonly preferred abbreviation, because it is easy to pronounce the plural “regexes”. They clearly distinguish the pattern from the surrounding text and punctuation.
Categories to define Regular Expression
Character escapes
Character classes
Anchors
Grouping constructs
Quantifiers
Backreference constructs
Alternation constructs
Example
The example provided below shows a simple program.
[csharp]
using System;
using System.Text.RegularExpressions;
namespace SpLessons
{
class Program
{
public static void Main(string[] args)
{
Regex regex = new Regex(@"\d+");
Match reg = regex.Match("SPLessons-3 Chapter Regular Expression");
if (reg.Success)
{
Console.WriteLine(reg.Value);
}
}
}
}
[/csharp]
Output: