. operator (C# Reference)

The dot, ., is typically used for member access.

You use the . token to access a member of a namespace or a type, as the following examples demonstrate:

  • Use . to access a nested namespace within a namespace, as the following example of a using directive shows:

    using System.Collections.Generic;
    
  • Use . to form a qualified name to access a type within a namespace, as the following code shows:

    System.Collections.Generic.IEnumerable<int> numbers = new int[] { 1, 2, 3 };
    

    Use the using directive to make the use of qualified names optional.

  • Use . to access type members, static and non-static, as the following code shows:

    var constants = new List<double>();
    constants.Add(Math.PI);
    constants.Add(Math.E);
    Console.WriteLine($"{constants.Count} values to show:");
    Console.WriteLine(string.Join(", ", constants));
    // Output:
    // 2 values to show:
    // 3.14159265358979, 2.71828182845905
    

You can also use . to invoke an extension method.

Operator overloadability

The operator . cannot be overloaded.

C# language specification

For more information, see the Member access section of the C# language specification.

See also