Skip to content

Commit 2bf6485

Browse files
authored
Replace broken snippet files (#5011)
* Replace broken snippet files * remove old token
1 parent a7244fb commit 2bf6485

File tree

9 files changed

+9
-63
lines changed

9 files changed

+9
-63
lines changed

docs/visual-basic/programming-guide/language-features/data-types/codesnippet/VisualBasic/nullable-value-types_1.vb

Lines changed: 0 additions & 3 deletions
This file was deleted.

docs/visual-basic/programming-guide/language-features/data-types/codesnippet/VisualBasic/nullable-value-types_2.vb

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/visual-basic/programming-guide/language-features/data-types/codesnippet/VisualBasic/nullable-value-types_3.vb

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/visual-basic/programming-guide/language-features/data-types/codesnippet/VisualBasic/nullable-value-types_4.vb

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/visual-basic/programming-guide/language-features/data-types/codesnippet/VisualBasic/nullable-value-types_5.vb

Lines changed: 0 additions & 5 deletions
This file was deleted.

docs/visual-basic/programming-guide/language-features/data-types/codesnippet/VisualBasic/nullable-value-types_6.vb

Lines changed: 0 additions & 18 deletions
This file was deleted.

docs/visual-basic/programming-guide/language-features/data-types/codesnippet/VisualBasic/nullable-value-types_7.vb

Lines changed: 0 additions & 12 deletions
This file was deleted.

docs/visual-basic/programming-guide/language-features/data-types/codesnippet/VisualBasic/nullable-value-types_8.vb

Lines changed: 0 additions & 9 deletions
This file was deleted.

docs/visual-basic/programming-guide/language-features/data-types/nullable-value-types.md

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
---
22
title: "Nullable Value Types (Visual Basic)"
3-
ms.custom: ""
43
ms.date: 07/20/2015
54
ms.prod: .net
6-
ms.reviewer: ""
7-
ms.suite: ""
85
ms.technology:
96
- "devlang-visual-basic"
107
ms.topic: "article"
@@ -17,7 +14,6 @@ helpviewer_keywords:
1714
- "nullable types [Visual Basic]"
1815
- "data types [Visual Basic], nullable"
1916
ms.assetid: 9ac3b602-6f96-4e6d-96f7-cd4e81c468a6
20-
caps.latest.revision: 23
2117
author: dotnet-bot
2218
ms.author: dotnetcontent
2319
---
@@ -26,7 +22,7 @@ Sometimes you work with a value type that does not have a defined value in certa
2622

2723
Each nullable type is constructed from the generic <xref:System.Nullable%601> structure. Consider a database that tracks work-related activities. The following example constructs a nullable `Boolean` type and declares a variable of that type. You can write the declaration in three ways:
2824

29-
[!code-vb[VbVbalrNullableValue#1](../../../../visual-basic/programming-guide/language-features/data-types/codesnippet/VisualBasic/nullable-value-types_1.vb)]
25+
[!code-vb[VbVbalrNullableValue#1](../../../../../samples/snippets/visualbasic/VS_Snippets_VBCSharp/VbVbalrNullableValue/VB/Class1.vb#1)]
3026

3127
The variable `ridesBusToWork` can hold a value of `True`, a value of `False`, or no value at all. Its initial default value is no value at all, which in this case could mean that the information has not yet been obtained for this person. In contrast, `False` could mean that the information has been obtained and the person does not ride the bus to work.
3228

@@ -40,26 +36,26 @@ Sometimes you work with a value type that does not have a defined value in certa
4036
### Default Values
4137
When you declare a variable with a nullable type, its <xref:System.Nullable%601.HasValue%2A> property has a default value of `False`. This means that by default the variable has no defined value, instead of the default value of its underlying value type. In the following example, the variable `numberOfChildren` initially has no defined value, even though the default value of the `Integer` type is 0.
4238

43-
[!code-vb[VbVbalrNullableValue#2](../../../../visual-basic/programming-guide/language-features/data-types/codesnippet/VisualBasic/nullable-value-types_2.vb)]
39+
[!code-vb[VbVbalrNullableValue#2](../../../../../samples/snippets/visualbasic/VS_Snippets_VBCSharp/VbVbalrNullableValue/VB/Class1.vb#2)]
4440

4541
A null value is useful to indicate an undefined or unknown value. If `numberOfChildren` had been declared as `Integer`, there would be no value that could indicate that the information is not currently available.
4642

4743
### Storing Values
4844
You store a value in a variable or property of a nullable type in the typical way. The following example assigns a value to the variable `numberOfChildren` declared in the previous example.
4945

50-
[!code-vb[VbVbalrNullableValue#3](../../../../visual-basic/programming-guide/language-features/data-types/codesnippet/VisualBasic/nullable-value-types_3.vb)]
46+
[!code-vb[VbVbalrNullableValue#3](../../../../../samples/snippets/visualbasic/VS_Snippets_VBCSharp/VbVbalrNullableValue/VB/Class1.vb#3)]
5147

5248
If a variable or property of a nullable type contains a defined value, you can cause it to revert to its initial state of not having a value assigned. You do this by setting the variable or property to `Nothing`, as the following example shows.
5349

54-
[!code-vb[VbVbalrNullableValue#4](../../../../visual-basic/programming-guide/language-features/data-types/codesnippet/VisualBasic/nullable-value-types_4.vb)]
50+
[!code-vb[VbVbalrNullableValue#4](../../../../../samples/snippets/visualbasic/VS_Snippets_VBCSharp/VbVbalrNullableValue/VB/Class1.vb#4)]
5551

5652
> [!NOTE]
5753
> Although you can assign `Nothing` to a variable of a nullable type, you cannot test it for `Nothing` by using the equal sign. Comparison that uses the equal sign, `someVar = Nothing`, always evaluates to `Nothing`. You can test the variable's <xref:System.Nullable%601.HasValue%2A> property for `False`, or test by using the `Is` or `IsNot` operator.
5854
5955
### Retrieving Values
6056
To retrieve the value of a variable of a nullable type, you should first test its <xref:System.Nullable%601.HasValue%2A> property to confirm that it has a value. If you try to read the value when <xref:System.Nullable%601.HasValue%2A> is `False`, Visual Basic throws an <xref:System.InvalidOperationException> exception. The following example shows the recommended way to read the variable `numberOfChildren` of the previous examples.
6157

62-
[!code-vb[VbVbalrNullableValue#5](../../../../visual-basic/programming-guide/language-features/data-types/codesnippet/VisualBasic/nullable-value-types_5.vb)]
58+
[!code-vb[VbVbalrNullableValue#5](../../../../../samples/snippets/visualbasic/VS_Snippets_VBCSharp/VbVbalrNullableValue/VB/Class1.vb#5)]
6359

6460
## Comparing Nullable Types
6561
When nullable `Boolean` variables are used in Boolean expressions, the result can be `True`, `False`, or `Nothing`. The following is the truth table for `And` and `Or`. Because `b1` and `b2` now have three possible values, there are nine combinations to evaluate.
@@ -78,7 +74,7 @@ Sometimes you work with a value type that does not have a defined value in certa
7874

7975
When the value of a Boolean variable or expression is `Nothing`, it is neither `true` nor `false`. Consider the following example.
8076

81-
[!code-vb[VbVbalrNullableValue#6](../../../../visual-basic/programming-guide/language-features/data-types/codesnippet/VisualBasic/nullable-value-types_6.vb)]
77+
[!code-vb[VbVbalrNullableValue#6](../../../../../samples/snippets/visualbasic/VS_Snippets_VBCSharp/VbVbalrNullableValue/VB/Class1.vb#6)]
8278

8379
In this example, `b1 And b2` evaluates to `Nothing`. As a result, the `Else` clause is executed in each `If` statement, and the output is as follows:
8480

@@ -92,14 +88,14 @@ Sometimes you work with a value type that does not have a defined value in certa
9288
## Propagation
9389
If one or both of the operands of an arithmetic, comparison, shift, or type operation is nullable, the result of the operation is also nullable. If both operands have values that are not `Nothing`, the operation is performed on the underlying values of the operands, as if neither were a nullable type. In the following example, variables `compare1` and `sum1` are implicitly typed. If you rest the mouse pointer over them, you will see that the compiler infers nullable types for both of them.
9490

95-
[!code-vb[VbVbalrNullableValue#7](../../../../visual-basic/programming-guide/language-features/data-types/codesnippet/VisualBasic/nullable-value-types_7.vb)]
91+
[!code-vb[VbVbalrNullableValue#7](../../../../../samples/snippets/visualbasic/VS_Snippets_VBCSharp/VbVbalrNullableValue/VB/Class1.vb#7)]
9692

9793
If one or both operands have a value of `Nothing`, the result will be `Nothing`.
9894

99-
[!code-vb[VbVbalrNullableValue#8](../../../../visual-basic/programming-guide/language-features/data-types/codesnippet/VisualBasic/nullable-value-types_8.vb)]
95+
[!code-vb[VbVbalrNullableValue#8](../../../../../samples/snippets/visualbasic/VS_Snippets_VBCSharp/VbVbalrNullableValue/VB/Class1.vb#8)]
10096

10197
## Using Nullable Types with Data
102-
A database is one of the most important places to use nullable types. Not all database objects currently support nullable types, but the designer-generated table adapters do. See "TableAdapter Support for Nullable Types" in [TableAdapter Overview](/visualstudio/data-tools/tableadapter-overview).
98+
A database is one of the most important places to use nullable types. Not all database objects currently support nullable types, but the designer-generated table adapters do. See "TableAdapter Support for Nullable Types" in [TableAdapter Overview](/visualstudio/data-tools/tableadapter-overview).
10399

104100
## See Also
105101
<xref:System.InvalidOperationException>

0 commit comments

Comments
 (0)