You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/core/rid-catalog.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ RID is short for *Runtime IDentifier*. RID values are used to identify target pl
15
15
They're used by .NET packages to represent platform-specific assets in NuGet packages. The following values are examples of RIDs: `linux-x64`, `ubuntu.14.04-x64`, `win7-x64`, or `osx.10.12-x64`.
16
16
For the packages with native dependencies, the RID designates on which platforms the package can be restored.
17
17
18
-
RIDs can be set in the `<RuntimeIdentifier>` element of your project file. They're also used via the `--runtime` option with the following [.NET Core CLI commands](./tools/index.md):
18
+
A single RID can be set in the `<RuntimeIdentifier>` element of your project file. Multiple RIDs can be defined as a semicolon-delimited list in the project file's `<RuntimeIdentifiers>` element. They're also used via the `--runtime` option with the following [.NET Core CLI commands](./tools/index.md):
Copy file name to clipboardExpand all lines: docs/csharp/language-reference/operators/null-conditional-operators.md
+19-9Lines changed: 19 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,17 +1,27 @@
1
1
---
2
2
title: "Null-conditional Operators (C# and Visual Basic)"
3
-
ms.date: 07/20/2015
3
+
ms.date: 04/03/2015
4
4
ms.prod: .net
5
5
ms.technology:
6
6
- "devlang-csharp"
7
7
ms.topic: "article"
8
+
dev_langs:
9
+
- "csharp"
10
+
- "vb"
11
+
helpviewer_keywords:
12
+
- "null-conditional operators [C#]"
13
+
- "null-conditional operators [Visual Basic]"
14
+
- "?. operator [C#]"
15
+
- "?. operator [Visual Basic]"
16
+
- "?[] operator [C#]"
17
+
- "?[] operator [Visual Basic]"
8
18
ms.assetid: 9c7b2c8f-a785-44ca-836c-407bfb6d27f5
9
19
caps.latest.revision: 3
10
20
author: "BillWagner"
11
21
ms.author: "wiwagn"
12
22
---
13
-
# Null-conditional Operators (C# and Visual Basic)
14
-
Used to test for null before performing a member access (`?.`) or index (`?[`) operation. These operators help you write less code to handle null checks, especially for descending into data structures.
23
+
# ?. and ?[] null-conditional Operators (C# and Visual Basic)
24
+
Used to test for null before performing a member access (`?.`) or index (`?[]`) operation. These operators help you write less code to handle null checks, especially for descending into data structures.
15
25
16
26
```csharp
17
27
int?length=customers?.Length; // null if customers is null
@@ -25,16 +35,16 @@ Dim first as Customer = customers?(0) ' null if customers is null
25
35
DimcountasInteger?=customers?(0)?.Orders?.Count()' null if customers, the first customer, or Orders is null
26
36
```
27
37
28
-
The last example demonstrates that the null-condition operators are short-circuiting. If one operation in a chain of conditional member access and index operation returns null, then the rest of the chain’s execution stops. Other operations with lower precedence in the expression continue. For example, `E`in the following executes in the second line, and the `??` and `==` operations execute. In the first line, the `??` short circuits and `E` does not execute when the left side evaluates to non-null.
38
+
The null-condition operators are short-circuiting. If one operation in a chain of conditional member access and index operation returns null, then the rest of the chain’s execution stops. In the following example, `E`doesn't execute if `A`, `B`, or `C`evaluates to null.
29
39
30
40
```csharp
31
-
A?.B?.C?[0] ??E
32
-
A?.B?.C?[0] ==E
41
+
A?.B?.C?.Do(E);
42
+
A?.B?.C?[E];
33
43
```
34
44
35
45
```vb
36
-
A?.B?.C?(0)??E
37
-
A?.B?.C?(0)==E
46
+
A?.B?.C?.Do(E);
47
+
A?.B?.C?(E);
38
48
```
39
49
40
50
Another use for the null-condition member access is invoking delegates in a thread-safe way with much less code. The old way requires code like the following:
@@ -63,7 +73,7 @@ PropertyChanged?.Invoke(e)
63
73
64
74
The new way is thread-safe because the compiler generates code to evaluate `PropertyChanged` one time only, keeping the result in a temporary variable.
65
75
66
-
You need to explicitly call the `Invoke` method because there is no null-conditional delegate invocation syntax `PropertyChanged?(e)`. There were too many ambiguous parsing situations to allow it.
76
+
You need to explicitly call the `Invoke` method because there is no null-conditional delegate invocation syntax `PropertyChanged?(e)`.
Copy file name to clipboardExpand all lines: docs/csharp/programming-guide/generics/generics-and-reflection.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,15 +34,15 @@ Because the Common Language Runtime (CLR) has access to generic type information
34
34
|<xref:System.Type.DeclaringMethod%2A>|Returns the generic method that defined the current generic type parameter, or null if the type parameter was not defined by a generic method.|
35
35
|<xref:System.Type.MakeGenericType%2A>|Substitutes the elements of an array of types for the type parameters of the current generic type definition, and returns a <xref:System.Type> object representing the resulting constructed type.|
36
36
37
-
In addition, new members are added to the <xref:System.Reflection.MethodInfo> class to enable run-time information for generic methods. See the <xref:System.Reflection.MethodInfo.IsGenericMethod%2A> property remarks for a list of invariant conditions for terms used to reflect on generic methods.
37
+
In addition, members of the <xref:System.Reflection.MethodInfo> class enable run-time information for generic methods. See the <xref:System.Reflection.MethodBase.IsGenericMethod%2A> property remarks for a list of invariant conditions for terms used to reflect on generic methods.
38
38
39
39
|System.Reflection.MemberInfo Member Name|Description|
|<xref:System.Reflection.MethodInfo.IsGenericMethod%2A>|Returns true if a method is generic.|
41
+
|<xref:System.Reflection.MethodBase.IsGenericMethod%2A>|Returns true if a method is generic.|
42
42
|<xref:System.Reflection.MethodInfo.GetGenericArguments%2A>|Returns an array of Type objects that represent the type arguments of a constructed generic method or the type parameters of a generic method definition.|
43
43
|<xref:System.Reflection.MethodInfo.GetGenericMethodDefinition%2A>|Returns the underlying generic method definition for the current constructed method.|
44
-
|<xref:System.Reflection.MethodInfo.ContainsGenericParameters%2A>|Returns true if the method or any of its enclosing types contain any type parameters for which specific types have not been supplied.|
45
-
|<xref:System.Reflection.MethodInfo.IsGenericMethodDefinition%2A>|Returns true if the current <xref:System.Reflection.MethodInfo> represents the definition of a generic method.|
44
+
|<xref:System.Reflection.MethodBase.ContainsGenericParameters%2A>|Returns true if the method or any of its enclosing types contain any type parameters for which specific types have not been supplied.|
45
+
|<xref:System.Reflection.MethodBase.IsGenericMethodDefinition%2A>|Returns true if the current <xref:System.Reflection.MethodInfo> represents the definition of a generic method.|
46
46
|<xref:System.Reflection.MethodInfo.MakeGenericMethod%2A>|Substitutes the elements of an array of types for the type parameters of the current generic method definition, and returns a <xref:System.Reflection.MethodInfo> object representing the resulting constructed method.|
The connection string builders allow you to construct syntactically valid connection strings at run time, so you do not have to manually concatenate connection string values in your code. For more information, see [Connection String Builders](../../../../docs/framework/data/adonet/connection-string-builders.md).
42
-
42
+
43
43
## Windows Authentication
44
44
We recommend using Windows Authentication (sometimes referred to as *integrated security*) to connect to data sources that support it. The syntax employed in the connection string varies by provider. The following table shows the Windows Authentication syntax used with the .NET Framework data providers.
45
45
@@ -54,9 +54,13 @@ Each .NET Framework data provider has a `Connection` object that inherits from <
54
54
> `Integrated Security=true` throws an exception when used with the `OleDb` provider.
55
55
56
56
## SqlClient Connection Strings
57
-
The syntax for a <xref:System.Data.SqlClient.SqlConnection> connection string is documented in the <xref:System.Data.SqlClient.SqlConnection.ConnectionString%2A?displayProperty=nameWithType> property. You can use the <xref:System.Data.SqlClient.SqlConnection.ConnectionString%2A> property to get or set a connection string for a SQL Server database. If you need to connect to an earlier version of SQL Server, you must use the .NET Framework Data Provider for OleDb (<xref:System.Data.OleDb>). Most connection string keywords also map to properties in the <xref:System.Data.SqlClient.SqlConnectionStringBuilder>.
58
-
59
-
Each of the following forms of syntax will use Windows Authentication to connect to the **AdventureWorks** database on a local server.
57
+
The syntax for a <xref:System.Data.SqlClient.SqlConnection> connection string is documented in the <xref:System.Data.SqlClient.SqlConnection.ConnectionString%2A?displayProperty=nameWithType> property. You can use the <xref:System.Data.SqlClient.SqlConnection.ConnectionString%2A> property to get or set a connection string for a SQL Server database. If you need to connect to an earlier version of SQL Server, you must use the .NET Framework Data Provider for OleDb (<xref:System.Data.OleDb>). Most connection string keywords also map to properties in the <xref:System.Data.SqlClient.SqlConnectionStringBuilder>.
58
+
59
+
> [!IMPORTANT]
60
+
> The default setting for the `Persist Security Info` keyword is `false`. Setting it to `true` or `yes` allows security-sensitive information, including the user ID and password, to be obtained from the connection after the connection has been opened. Keep `Persist Security Info` set to `false` to ensure that an untrusted source does not have access to sensitive connection string information.
61
+
62
+
### Windows authentication with SqlClient
63
+
Each of the following forms of syntax uses Windows Authentication to connect to the **AdventureWorks** database on a local server.
@@ -67,26 +71,26 @@ Each .NET Framework data provider has a `Connection` object that inherits from <
67
71
database=AdventureWorks;server=(local)"
68
72
```
69
73
70
-
### SQL Server Logins
74
+
### SQL Server authentication with SqlClient
71
75
Windows Authentication is preferred for connecting to SQL Server. However, if SQL Server Authentication is required, use the following syntax to specify a user name and password. In this example, asterisks are used to represent a valid user name and password.
> The default setting for the `Persist Security Info` keyword is `false`. Setting it to `true` or `yes` allows security-sensitive information, including the user ID and password, to be obtained from the connection after the connection has been opened. Keep `Persist Security Info` set to `false` to ensure that an untrusted source does not have access to sensitive connection string information.
79
-
80
-
To connect to a named instance of SQL Server, use the *server name\instance name* syntax.
80
+
81
+
When you connect to Azure SQL Database or to Azure SQL Data Warehouse and provide a login in the format `user@servername`, make sure that the `servername` value in the login matches the value provided for `Server=`.
82
+
83
+
> [!NOTE]
84
+
> Windows authentication takes precedence over SQL Server logins. If you specify both Integrated Security=true as well as a user name and password, the user name and password will be ignored and Windows authentication will be used.
85
+
86
+
### Connect to a named instance of SQL Server
87
+
To connect to a named instance of SQL Server, use the *server name\instance name* syntax.
81
88
82
89
```
83
90
Data Source=MySqlServer\MSSQL1;"
84
91
```
85
-
86
-
You can also set the <xref:System.Data.SqlClient.SqlConnectionStringBuilder.DataSource%2A> property of the `SqlConnectionStringBuilder` to the instance name when building a connection string. The <xref:System.Data.SqlClient.SqlConnection.DataSource%2A> property of a <xref:System.Data.SqlClient.SqlConnection> object is read-only.
87
-
88
-
> [!NOTE]
89
-
> Windows authentication takes precedence over SQL Server logins. If you specify both Integrated Security=true as well as a user name and password, the user name and password will be ignored and Windows authentication will be used.
92
+
93
+
You can also set the <xref:System.Data.SqlClient.SqlConnectionStringBuilder.DataSource%2A> property of the `SqlConnectionStringBuilder` to the instance name when building a connection string. The <xref:System.Data.SqlClient.SqlConnection.DataSource%2A> property of a <xref:System.Data.SqlClient.SqlConnection> object is read-only.
90
94
91
95
### Type System Version Changes
92
96
The `Type System Version` keyword in a <xref:System.Data.SqlClient.SqlConnection.ConnectionString%2A?displayProperty=nameWithType> specifies the client-side representation of [!INCLUDE[ssNoVersion](../../../../includes/ssnoversion-md.md)] types. See <xref:System.Data.SqlClient.SqlConnection.ConnectionString%2A?displayProperty=nameWithType> for more information about the `Type System Version` keyword.
For another sample, see [How to store and fetch binary data into a file stream column](http://www.codeproject.com/Articles/32216/How-to-store-and-fetch-binary-data-into-a-file-str).
Copy file name to clipboardExpand all lines: docs/framework/reflection-and-codedom/reflection-and-generic-types.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,15 +62,15 @@ ms.workload:
62
62
63
63
<aname="is_this_a_generic_type_or_method"></a>
64
64
## Is This a Generic Type or Method?
65
-
When you use reflection to examine an unknown type, represented by an instance of <xref:System.Type>, use the <xref:System.Type.IsGenericType%2A> property to determine whether the unknown type is generic. It returns `true` if the type is generic. Similarly, when you examine an unknown method, represented by an instance of the <xref:System.Reflection.MethodInfo> class, use the <xref:System.Reflection.MethodInfo.IsGenericMethod%2A> property to determine whether the method is generic.
65
+
When you use reflection to examine an unknown type, represented by an instance of <xref:System.Type>, use the <xref:System.Type.IsGenericType%2A> property to determine whether the unknown type is generic. It returns `true` if the type is generic. Similarly, when you examine an unknown method, represented by an instance of the <xref:System.Reflection.MethodInfo> class, use the <xref:System.Reflection.MethodBase.IsGenericMethod%2A> property to determine whether the method is generic.
66
66
67
67
### Is This a Generic Type or Method Definition?
68
-
Use the <xref:System.Type.IsGenericTypeDefinition%2A> property to determine whether a <xref:System.Type> object represents a generic type definition, and use the <xref:System.Reflection.MethodInfo.IsGenericMethodDefinition%2A> method to determine whether a <xref:System.Reflection.MethodInfo> represents a generic method definition.
68
+
Use the <xref:System.Type.IsGenericTypeDefinition%2A> property to determine whether a <xref:System.Type> object represents a generic type definition, and use the <xref:System.Reflection.MethodBase.IsGenericMethodDefinition%2A> method to determine whether a <xref:System.Reflection.MethodInfo> represents a generic method definition.
69
69
70
70
Generic type and method definitions are the templates from which instantiable types are created. Generic types in the .NET Framework class library, such as <xref:System.Collections.Generic.Dictionary%602>, are generic type definitions.
71
71
72
72
### Is the Type or Method Open or Closed?
73
-
A generic type or method is closed if instantiable types have been substituted for all its type parameters, including all the type parameters of all enclosing types. You can only create an instance of a generic type if it is closed. The <xref:System.Type.ContainsGenericParameters%2A?displayProperty=nameWithType> property returns `true` if a type is open. For methods, the <xref:System.Reflection.MethodInfo.ContainsGenericParameters%2A?displayProperty=nameWithType> method performs the same function.
73
+
A generic type or method is closed if instantiable types have been substituted for all its type parameters, including all the type parameters of all enclosing types. You can only create an instance of a generic type if it is closed. The <xref:System.Type.ContainsGenericParameters%2A?displayProperty=nameWithType> property returns `true` if a type is open. For methods, the <xref:System.Reflection.MethodBase.ContainsGenericParameters%2A?displayProperty=nameWithType> method performs the same function.
74
74
75
75
[Back to top](#top)
76
76
@@ -146,7 +146,7 @@ generic<typename V, typename W> ref class D : B<int, V> {};
146
146
147
147
<a name="invariants"></a>
148
148
## Invariants
149
-
For a table of the invariant conditions for common terms in reflection for generic types, see <xref:System.Type.IsGenericType%2A?displayProperty=nameWithType>. For additional terms relating to generic methods, see <xref:System.Reflection.MethodInfo.IsGenericMethod%2A?displayProperty=nameWithType>.
149
+
For a table of the invariant conditions for common terms in reflection for generic types, see <xref:System.Type.IsGenericType%2A?displayProperty=nameWithType>. For additional terms relating to generic methods, see <xref:System.Reflection.MethodBase.IsGenericMethod%2A?displayProperty=nameWithType>.
0 commit comments