Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "Statements, Expressions, and Operators - C# Programming Guide"
ms.custom: seodec18
ms.date: 07/20/2015
helpviewer_keywords:
helpviewer_keywords:
- "expressions [C#]"
- "operators [C#]"
- "C# language, statements"
Expand All @@ -12,33 +12,35 @@ helpviewer_keywords:
ms.assetid: 20f8469d-5a6a-4084-ad90-0856b7e97e45
---
# Statements, Expressions, and Operators (C# Programming Guide)
The C# code that comprises an application consists of statements made up of keywords, expressions and operators. This section contains information regarding these fundamental elements of a C# program.

For more information, see:

- [Statements](statements.md)

- [Expressions](expressions.md)

- [Expression-bodied members](expression-bodied-members.md)

- [Operators](operators.md)

- [Anonymous Functions](anonymous-functions.md)

- [Overloadable Operators](overloadable-operators.md)

- [Conversion Operators](conversion-operators.md)

- [Using Conversion Operators](using-conversion-operators.md)

- [How to: Implement User-Defined Conversions Between Structs](how-to-implement-user-defined-conversions-between-structs.md)

- [Equality Comparisons](equality-comparisons.md)

## C# Language Specification
[!INCLUDE[CSharplangspec](~/includes/csharplangspec-md.md)]


The C# code that comprises an application consists of statements made up of keywords, expressions and operators. This section contains information regarding these fundamental elements of a C# program.

For more information, see:

- [Statements](statements.md)

- [Expressions](expressions.md)

- [Expression-bodied members](expression-bodied-members.md)

- [Operators](operators.md)

- [Anonymous Functions](anonymous-functions.md)

- [Overloadable Operators](overloadable-operators.md)

- [Conversion Operators](conversion-operators.md)

- [Using Conversion Operators](using-conversion-operators.md)

- [How to: Implement User-Defined Conversions Between Structs](how-to-implement-user-defined-conversions-between-structs.md)

- [Equality Comparisons](equality-comparisons.md)

## C# Language Specification

[!INCLUDE[CSharplangspec](~/includes/csharplangspec-md.md)]

## See also

- [C# Programming Guide](../../../csharp/programming-guide/index.md)
Expand Down
138 changes: 70 additions & 68 deletions docs/csharp/programming-guide/xmldoc/processing-the-xml-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,79 +2,81 @@
title: "Processing the XML File - C# Programming Guide"
ms.custom: seodec18
ms.date: 07/20/2015
helpviewer_keywords:
helpviewer_keywords:
- "XML processing [C#]"
- "XML [C#], processing"
ms.assetid: 60c71193-9dac-4cd3-98c5-100bd0edcc42
---
# Processing the XML File (C# Programming Guide)
The compiler generates an ID string for each construct in your code that is tagged to generate documentation. (For information about how to tag your code, see [Recommended Tags for Documentation Comments](../../../csharp/programming-guide/xmldoc/recommended-tags-for-documentation-comments.md).) The ID string uniquely identifies the construct. Programs that process the XML file can use the ID string to identify the corresponding .NET Framework metadata/reflection item that the documentation applies to.

The XML file is not a hierarchical representation of your code; it is a flat list that has a generated ID for each element.

The compiler observes the following rules when it generates the ID strings:

- No white space is in the string.

- The first part of the ID string identifies the kind of member being identified, by way of a single character followed by a colon. The following member types are used:

|Character|Description|
|---------------|-----------------|
|N|namespace<br /><br /> You cannot add documentation comments to a namespace, but you can make cref references to them, where supported.|
|T|type: class, interface, struct, enum, delegate|
|F|field|
|P|property (including indexers or other indexed properties)|
|M|method (including such special methods as constructors, operators, and so forth)|
|E|event|
|!|error string<br /><br /> The rest of the string provides information about the error. The C# compiler generates error information for links that cannot be resolved.|

- The second part of the string is the fully qualified name of the item, starting at the root of the namespace. The name of the item, its enclosing type(s), and namespace are separated by periods. If the name of the item itself has periods, they are replaced by the hash-sign ('#'). It is assumed that no item has a hash-sign directly in its name. For example, the fully qualified name of the String constructor would be "System.String.#ctor".

- For properties and methods, if there are arguments to the method, the argument list enclosed in parentheses follows. If there are no arguments, no parentheses are present. The arguments are separated by commas. The encoding of each argument follows directly how it is encoded in a .NET Framework signature:

- Base types. Regular types (ELEMENT_TYPE_CLASS or ELEMENT_TYPE_VALUETYPE) are represented as the fully qualified name of the type.

- Intrinsic types (for example, ELEMENT_TYPE_I4, ELEMENT_TYPE_OBJECT, ELEMENT_TYPE_STRING, ELEMENT_TYPE_TYPEDBYREF. and ELEMENT_TYPE_VOID) are represented as the fully qualified name of the corresponding full type. For example, System.Int32 or System.TypedReference.

- ELEMENT_TYPE_PTR is represented as a '\*' following the modified type.

- ELEMENT_TYPE_BYREF is represented as a '\@' following the modified type.

- ELEMENT_TYPE_PINNED is represented as a '^' following the modified type. The C# compiler never generates this.

- ELEMENT_TYPE_CMOD_REQ is represented as a '&#124;' and the fully qualified name of the modifier class, following the modified type. The C# compiler never generates this.

- ELEMENT_TYPE_CMOD_OPT is represented as a '!' and the fully qualified name of the modifier class, following the modified type.

- ELEMENT_TYPE_SZARRAY is represented as "[]" following the element type of the array.

- ELEMENT_TYPE_GENERICARRAY is represented as "[?]" following the element type of the array. The C# compiler never generates this.

- ELEMENT_TYPE_ARRAY is represented as [*lowerbound*:`size`,*lowerbound*:`size`] where the number of commas is the rank - 1, and the lower bounds and size of each dimension, if known, are represented in decimal. If a lower bound or size is not specified, it is simply omitted. If the lower bound and size for a particular dimension are omitted, the ':' is omitted as well. For example, a 2-dimensional array with 1 as the lower bounds and unspecified sizes is [1:,1:].

- ELEMENT_TYPE_FNPTR is represented as "=FUNC:`type`(*signature*)", where `type` is the return type, and *signature* is the arguments of the method. If there are no arguments, the parentheses are omitted. The C# compiler never generates this.

The following signature components are not represented because they are never used for differentiating overloaded methods:

- calling convention

- return type

- ELEMENT_TYPE_SENTINEL

- For conversion operators only (op_Implicit and op_Explicit), the return value of the method is encoded as a '~' followed by the return type, as encoded above.

- For generic types, the name of the type is followed by a backtick and then a number that indicates the number of generic type parameters. For example:

``<member name="T:SampleClass`2">`` is the tag for a type that is defined as `public class SampleClass<T, U>`.

For methods taking generic types as parameters, the generic type parameters are specified as numbers prefaced with backticks (for example \`0,\`1). Each number representing a zero-based array notation for the type's generic parameters.

## Examples
The following examples show how the ID strings for a class and its members would be generated:

[!code-csharp[csProgGuidePointers#21](~/samples/snippets/csharp/VS_Snippets_VBCSharp/csProgGuidePointers/CS/Pointers.cs#21)]


The compiler generates an ID string for each construct in your code that is tagged to generate documentation. (For information about how to tag your code, see [Recommended Tags for Documentation Comments](../../../csharp/programming-guide/xmldoc/recommended-tags-for-documentation-comments.md).) The ID string uniquely identifies the construct. Programs that process the XML file can use the ID string to identify the corresponding .NET Framework metadata/reflection item that the documentation applies to.

The XML file is not a hierarchical representation of your code; it is a flat list that has a generated ID for each element.

The compiler observes the following rules when it generates the ID strings:

- No white space is in the string.

- The first part of the ID string identifies the kind of member being identified, by way of a single character followed by a colon. The following member types are used:

|Character|Description|
|---------------|-----------------|
|N|namespace<br /><br /> You cannot add documentation comments to a namespace, but you can make cref references to them, where supported.|
|T|type: class, interface, struct, enum, delegate|
|F|field|
|P|property (including indexers or other indexed properties)|
|M|method (including such special methods as constructors, operators, and so forth)|
|E|event|
|!|error string<br /><br /> The rest of the string provides information about the error. The C# compiler generates error information for links that cannot be resolved.|

- The second part of the string is the fully qualified name of the item, starting at the root of the namespace. The name of the item, its enclosing type(s), and namespace are separated by periods. If the name of the item itself has periods, they are replaced by the hash-sign ('#'). It is assumed that no item has a hash-sign directly in its name. For example, the fully qualified name of the String constructor would be "System.String.#ctor".

- For properties and methods, if there are arguments to the method, the argument list enclosed in parentheses follows. If there are no arguments, no parentheses are present. The arguments are separated by commas. The encoding of each argument follows directly how it is encoded in a .NET Framework signature:

- Base types. Regular types (ELEMENT_TYPE_CLASS or ELEMENT_TYPE_VALUETYPE) are represented as the fully qualified name of the type.

- Intrinsic types (for example, ELEMENT_TYPE_I4, ELEMENT_TYPE_OBJECT, ELEMENT_TYPE_STRING, ELEMENT_TYPE_TYPEDBYREF. and ELEMENT_TYPE_VOID) are represented as the fully qualified name of the corresponding full type. For example, System.Int32 or System.TypedReference.

- ELEMENT_TYPE_PTR is represented as a '\*' following the modified type.

- ELEMENT_TYPE_BYREF is represented as a '\@' following the modified type.

- ELEMENT_TYPE_PINNED is represented as a '^' following the modified type. The C# compiler never generates this.

- ELEMENT_TYPE_CMOD_REQ is represented as a '&#124;' and the fully qualified name of the modifier class, following the modified type. The C# compiler never generates this.

- ELEMENT_TYPE_CMOD_OPT is represented as a '!' and the fully qualified name of the modifier class, following the modified type.

- ELEMENT_TYPE_SZARRAY is represented as "[]" following the element type of the array.

- ELEMENT_TYPE_GENERICARRAY is represented as "[?]" following the element type of the array. The C# compiler never generates this.

- ELEMENT_TYPE_ARRAY is represented as [*lowerbound*:`size`,*lowerbound*:`size`] where the number of commas is the rank - 1, and the lower bounds and size of each dimension, if known, are represented in decimal. If a lower bound or size is not specified, it is simply omitted. If the lower bound and size for a particular dimension are omitted, the ':' is omitted as well. For example, a 2-dimensional array with 1 as the lower bounds and unspecified sizes is [1:,1:].

- ELEMENT_TYPE_FNPTR is represented as "=FUNC:`type`(*signature*)", where `type` is the return type, and *signature* is the arguments of the method. If there are no arguments, the parentheses are omitted. The C# compiler never generates this.

The following signature components are not represented because they are never used for differentiating overloaded methods:

- calling convention

- return type

- ELEMENT_TYPE_SENTINEL

- For conversion operators only (op_Implicit and op_Explicit), the return value of the method is encoded as a '~' followed by the return type, as encoded above.

- For generic types, the name of the type is followed by a backtick and then a number that indicates the number of generic type parameters. For example:

``<member name="T:SampleClass`2">`` is the tag for a type that is defined as `public class SampleClass<T, U>`.

For methods taking generic types as parameters, the generic type parameters are specified as numbers prefaced with backticks (for example \`0,\`1). Each number representing a zero-based array notation for the type's generic parameters.

## Examples

The following examples show how the ID strings for a class and its members would be generated:

[!code-csharp[csProgGuidePointers#21](~/samples/snippets/csharp/VS_Snippets_VBCSharp/csProgGuidePointers/CS/Pointers.cs#21)]

## See also

- [C# Programming Guide](../../../csharp/programming-guide/index.md)
Expand Down
32 changes: 16 additions & 16 deletions docs/csharp/tour-of-csharp/classes-and-objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,42 +28,42 @@ The members of a class are either static members or instance members. Static mem
The following provides an overview of the kinds of members a class can contain.

* Constants
- Constant values associated with the class
- Constant values associated with the class
* Fields
- Variables of the class
- Variables of the class
* Methods
- Computations and actions that can be performed by the class
- Computations and actions that can be performed by the class
* Properties
- Actions associated with reading and writing named properties of the class
- Actions associated with reading and writing named properties of the class
* Indexers
- Actions associated with indexing instances of the class like an array
- Actions associated with indexing instances of the class like an array
* Events
- Notifications that can be generated by the class
- Notifications that can be generated by the class
* Operators
- Conversions and expression operators supported by the class
- Conversions and expression operators supported by the class
* Constructors
- Actions required to initialize instances of the class or the class itself
- Actions required to initialize instances of the class or the class itself
* Finalizers
- Actions to perform before instances of the class are permanently discarded
- Actions to perform before instances of the class are permanently discarded
* Types
- Nested types declared by the class
- Nested types declared by the class

## Accessibility

Each member of a class has an associated accessibility, which controls the regions of program text that are able to access the member. There are six possible forms of accessibility. These are summarized below.

* `public`
- Access not limited
- Access not limited
* `protected`
- Access limited to this class or classes derived from this class
- Access limited to this class or classes derived from this class
* `internal`
- Access limited to the current assembly (.exe, .dll, etc.)
- Access limited to the current assembly (.exe, .dll, etc.)
* `protected internal`
- Access limited to the containing class, classes derived from the containing class, or classes within the same assembly
- Access limited to the containing class, classes derived from the containing class, or classes within the same assembly
* `private`
- Access limited to this class
- Access limited to this class
* `private protected`
- Access limited to the containing class or classes derived from the containing type within the same assembly
- Access limited to the containing class or classes derived from the containing type within the same assembly

## Type parameters

Expand Down
12 changes: 6 additions & 6 deletions docs/csharp/tutorials/working-with-linq.md
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,9 @@ Aside from LINQ, you learned a bit about a technique magicians use for card tric

For more information on LINQ, see:
- [Language Integrated Query (LINQ)](../programming-guide/concepts/linq/index.md)
- [Introduction to LINQ](../programming-guide/concepts/linq/introduction-to-linq.md)
- [Getting Started With LINQ in C#](../programming-guide/concepts/linq/getting-started-with-linq.md)
- [Basic LINQ Query Operations (C#)](../programming-guide/concepts/linq/basic-linq-query-operations.md)
- [Data Transformations With LINQ (C#)](../programming-guide/concepts/linq/data-transformations-with-linq.md)
- [Query Syntax and Method Syntax in LINQ (C#)](../programming-guide/concepts/linq/query-syntax-and-method-syntax-in-linq.md)
- [C# Features That Support LINQ](../programming-guide/concepts/linq/features-that-support-linq.md)
- [Introduction to LINQ](../programming-guide/concepts/linq/introduction-to-linq.md)
- [Getting Started With LINQ in C#](../programming-guide/concepts/linq/getting-started-with-linq.md)
- [Basic LINQ Query Operations (C#)](../programming-guide/concepts/linq/basic-linq-query-operations.md)
- [Data Transformations With LINQ (C#)](../programming-guide/concepts/linq/data-transformations-with-linq.md)
- [Query Syntax and Method Syntax in LINQ (C#)](../programming-guide/concepts/linq/query-syntax-and-method-syntax-in-linq.md)
- [C# Features That Support LINQ](../programming-guide/concepts/linq/features-that-support-linq.md)
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ DbNewInstanceExpression can only occur in the following two cases:

- As the Projection property of DbProjectExpression. When used as such the following restrictions apply:

- The result type must be a row type.
- The result type must be a row type.

- Each of its arguments is an expression that produces a result with a primitive type. Typically, each argument is a scalar expression, like a PropertyExpression over a DbVariableReferenceExpression, a function invocation, or an arithmetic computation of the DbPropertyExpression over a DbVariableReferenceExpression or a function invocation. However, an expression representing a scalar subquery can also occur in the list of arguments for a DbNewInstanceExpression. An expression that represents a scalar subquery is an expression tree that represents a subquery that returns exactly one row and one column of a primitive type with a DbElementExpression object root
- Each of its arguments is an expression that produces a result with a primitive type. Typically, each argument is a scalar expression, like a PropertyExpression over a DbVariableReferenceExpression, a function invocation, or an arithmetic computation of the DbPropertyExpression over a DbVariableReferenceExpression or a function invocation. However, an expression representing a scalar subquery can also occur in the list of arguments for a DbNewInstanceExpression. An expression that represents a scalar subquery is an expression tree that represents a subquery that returns exactly one row and one column of a primitive type with a DbElementExpression object root

- With a collection return type, in which case it defines a new collection of the expressions provided as arguments.

Expand Down
Loading