() operator (C# Reference)

Parentheses, (), are typically used for method or delegate invocation or in cast expressions.

You also use parentheses to specify the order in which to evaluate operations in an expression. For more information, see the Adding parentheses section of the Operators article. For the list of operators ordered by precedence level, see C# operators.

Method invocation

The following example demonstrates how to invoke a method, with or without arguments, and a delegate:

Action<int> display = s => Console.WriteLine(s);

var numbers = new List<int>();
display(numbers.Count);   // output: 2

display(numbers.Count);   // output: 0

You also use parentheses when you invoke a constructor with a new operator.

For more information about methods, see Methods. For more information about delegates, see Delegates.

Cast expression

A cast expression of the form (T)E invokes a conversion operator to convert the value of expression E to type T. If no explicit conversion exists from the type of E to type T, a compile-time error occurs. For information about how to define a conversion operator, see the explicit and implicit keyword articles.

The following example demonstrates type conversion between numeric types:

double x = 1234.7;
int a = (int)x;
Console.WriteLine(a);   // output: 1234

For more information about predefined explicit conversions between numeric types, see Explicit numeric conversions table.

For more information, see Casting and type conversions and Conversion operators.

Operator overloadability

The operator () cannot be overloaded.

C# language specification

For more information, see the Invocation expressions and Cast expressions sections of the C# language specification.

See also