Skip to content

Commit 29f026b

Browse files
CopilotBillWagner
andcommitted
Update CType terminology from Function to Operator in core documentation
Co-authored-by: BillWagner <[email protected]>
1 parent a48d4a1 commit 29f026b

File tree

10 files changed

+19
-19
lines changed

10 files changed

+19
-19
lines changed

docs/visual-basic/language-reference/functions/ctype-function.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
---
2-
description: "Learn more about: CType Function (Visual Basic)"
3-
title: "CType Function"
2+
description: "Learn more about: CType Operator (Visual Basic)"
3+
title: "CType Operator"
44
ms.date: 07/20/2015
55
f1_keywords:
66
- "vb.CType"
77
helpviewer_keywords:
88
- "expression conversion results"
99
- "explicit data type conversions [Visual Basic]"
10-
- "CType function"
10+
- "CType operator"
1111
- "conversions [Visual Basic], expression"
1212
ms.assetid: dd4b29e7-6fa1-428c-877e-69955420bb72
1313
---
1414

15-
# CType Function (Visual Basic)
15+
# CType Operator (Visual Basic)
1616

1717
Returns the result of explicitly converting an expression to a specified data type, object, structure, class, or interface.
1818

@@ -66,7 +66,7 @@ Type conversions of dynamic objects are performed by user-defined dynamic conver
6666

6767
## Example
6868

69-
The following example uses the `CType` function to convert an expression to the `Single` data type.
69+
The following example uses the `CType` operator to convert an expression to the `Single` data type.
7070

7171
[!code-vb[VbVbalrFunctions#24](~/samples/snippets/visualbasic/VS_Snippets_VBCSharp/VbVbalrFunctions/VB/Class1.vb#24)]
7272

docs/visual-basic/language-reference/functions/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ The topics in this section contain tables of the Visual Basic run-time member fu
2424

2525
[Type Conversion Functions](type-conversion-functions.md)
2626

27-
[CType Function](ctype-function.md)
27+
[CType Operator](ctype-function.md)
2828

2929
## Related Sections
3030

docs/visual-basic/language-reference/functions/type-conversion-functions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,9 @@ Dim i3 As Integer = CInt(Math.Round(s)) ' Result: 174
188188

189189
If you need to convert to or from a string representation of a value in a format other than the one specified by your locale, you cannot use the Visual Basic type conversion functions. To do this, use the `ToString(IFormatProvider)` and `Parse(String, IFormatProvider)` methods of that value's type. For example, use <xref:System.Double.Parse%2A?displayProperty=nameWithType> when converting a string to a `Double`, and use <xref:System.Double.ToString%2A?displayProperty=nameWithType> when converting a value of type `Double` to a string.
190190

191-
## CType Function
191+
## CType Operator
192192

193-
The [CType Function](ctype-function.md) takes a second argument, `typename`, and coerces `expression` to `typename`, where `typename` can be any data type, structure, class, or interface to which there exists a valid conversion.
193+
The [CType Operator](ctype-function.md) takes a second argument, `typename`, and coerces `expression` to `typename`, where `typename` can be any data type, structure, class, or interface to which there exists a valid conversion.
194194

195195
For a comparison of `CType` with the other type conversion keywords, see [DirectCast Operator](../operators/directcast-operator.md) and [TryCast Operator](../operators/trycast-operator.md).
196196

docs/visual-basic/language-reference/operators/directcast-operator.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Introduces a type conversion operation based on inheritance or implementation.
1717

1818
`DirectCast` does not use the Visual Basic run-time helper routines for conversion, so it can provide somewhat better performance than `CType` when converting to and from data type `Object`.
1919

20-
You use the `DirectCast` keyword similar to the way you use the [CType Function](../functions/ctype-function.md) and the [TryCast Operator](trycast-operator.md) keyword. You supply an expression as the first argument and a type to convert it to as the second argument. `DirectCast` requires an inheritance or implementation relationship between the data types of the two arguments. This means that one type must inherit from or implement the other.
20+
You use the `DirectCast` keyword similar to the way you use the [CType Operator](../functions/ctype-function.md) and the [TryCast Operator](trycast-operator.md) keyword. You supply an expression as the first argument and a type to convert it to as the second argument. `DirectCast` requires an inheritance or implementation relationship between the data types of the two arguments. This means that one type must inherit from or implement the other.
2121

2222
## Errors and Failures
2323

@@ -29,7 +29,7 @@ Introduces a type conversion operation based on inheritance or implementation.
2929

3030
|Keyword|Data types|Argument relationship|Run-time failure|
3131
|---|---|---|---|
32-
|[CType Function](../functions/ctype-function.md)|Any data types|Widening or narrowing conversion must be defined between the two data types|Throws <xref:System.InvalidCastException>|
32+
|[CType Operator](../functions/ctype-function.md)|Any data types|Widening or narrowing conversion must be defined between the two data types|Throws <xref:System.InvalidCastException>|
3333
|`DirectCast`|Any data types|One type must inherit from or implement the other type|Throws <xref:System.InvalidCastException>|
3434
|[TryCast Operator](trycast-operator.md)|Reference types only|One type must inherit from or implement the other type|Returns [Nothing](../nothing.md)|
3535

docs/visual-basic/language-reference/operators/trycast-operator.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Introduces a type conversion operation that does not throw an exception.
1717

1818
If an attempted conversion fails, `CType` and `DirectCast` both throw an <xref:System.InvalidCastException> error. This can adversely affect the performance of your application. `TryCast` returns [Nothing](../nothing.md), so that instead of having to handle a possible exception, you need only test the returned result against `Nothing`.
1919

20-
You use the `TryCast` keyword the same way you use the [CType Function](../functions/ctype-function.md) and the [DirectCast Operator](directcast-operator.md) keyword. You supply an expression as the first argument and a type to convert it to as the second argument. `TryCast` operates only on reference types, such as classes and interfaces. It requires an inheritance or implementation relationship between the two types. This means that one type must inherit from or implement the other.
20+
You use the `TryCast` keyword the same way you use the [CType Operator](../functions/ctype-function.md) and the [DirectCast Operator](directcast-operator.md) keyword. You supply an expression as the first argument and a type to convert it to as the second argument. `TryCast` operates only on reference types, such as classes and interfaces. It requires an inheritance or implementation relationship between the two types. This means that one type must inherit from or implement the other.
2121

2222
## Errors and Failures
2323

@@ -29,7 +29,7 @@ Introduces a type conversion operation that does not throw an exception.
2929

3030
|Keyword|Data types|Argument relationship|Run-time failure|
3131
|---|---|---|---|
32-
|[CType Function](../functions/ctype-function.md)|Any data types|Widening or narrowing conversion must be defined between the two data types|Throws <xref:System.InvalidCastException>|
32+
|[CType Operator](../functions/ctype-function.md)|Any data types|Widening or narrowing conversion must be defined between the two data types|Throws <xref:System.InvalidCastException>|
3333
|[DirectCast Operator](directcast-operator.md)|Any data types|One type must inherit from or implement the other type|Throws <xref:System.InvalidCastException>|
3434
|`TryCast`|Reference types only|One type must inherit from or implement the other type|Returns [Nothing](../nothing.md)|
3535

docs/visual-basic/programming-guide/language-features/data-types/how-to-convert-an-object-to-another-type.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ms.assetid: 60cb5fc7-7ba4-4ab5-9c24-480fa12ddcdc
88
---
99
# How to: Convert an Object to Another Type in Visual Basic
1010

11-
You convert an `Object` variable to another data type by using a conversion keyword such as [CType Function](../../../language-reference/functions/ctype-function.md).
11+
You convert an `Object` variable to another data type by using a conversion keyword such as [CType Operator](../../../language-reference/functions/ctype-function.md).
1212

1313
## Example
1414

docs/visual-basic/programming-guide/language-features/data-types/implicit-and-explicit-conversions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ The following table shows the available conversion keywords.
6969
|`CULng`|[ULong Data Type](../../../language-reference/data-types/ulong-data-type.md)|Any numeric type (including `Byte`, `SByte`, and enumerated types), `Boolean`, `String`, `Object`|
7070
|`CUShort`|[UShort Data Type](../../../language-reference/data-types/ushort-data-type.md)|Any numeric type (including `Byte`, `SByte`, and enumerated types), `Boolean`, `String`, `Object`|
7171

72-
## The CType Function
72+
## The CType Operator
7373

74-
The [CType Function](../../../language-reference/functions/ctype-function.md) operates on two arguments. The first is the expression to be converted, and the second is the destination data type or object class. Note that the first argument must be an expression, not a type.
74+
The [CType Operator](../../../language-reference/functions/ctype-function.md) operates on two arguments. The first is the expression to be converted, and the second is the destination data type or object class. Note that the first argument must be an expression, not a type.
7575

7676
`CType` is an *inline function*, meaning the compiled code makes the conversion, often without generating a function call. This improves performance.
7777

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Note that it is not sufficient to declare `decimalRemainder` as `Decimal`. You m
6565

6666
## Boolean Type Does Not Convert to Numeric Type Accurately
6767

68-
[Boolean Data Type](../../../language-reference/data-types/boolean-data-type.md) values are not stored as numbers, and the stored values are not intended to be equivalent to numbers. For compatibility with earlier versions, Visual Basic provides conversion keywords ([CType Function](../../../language-reference/functions/ctype-function.md), `CBool`, `CInt`, and so on) to convert between `Boolean` and numeric types. However, other languages sometimes perform these conversions differently, as do the .NET Framework methods.
68+
[Boolean Data Type](../../../language-reference/data-types/boolean-data-type.md) values are not stored as numbers, and the stored values are not intended to be equivalent to numbers. For compatibility with earlier versions, Visual Basic provides conversion keywords ([CType Operator](../../../language-reference/functions/ctype-function.md), `CBool`, `CInt`, and so on) to convert between `Boolean` and numeric types. However, other languages sometimes perform these conversions differently, as do the .NET Framework methods.
6969

7070
You should never write code that relies on equivalent numeric values for `True` and `False`. Whenever possible, you should restrict usage of `Boolean` variables to the logical values for which they are designed. If you must mix `Boolean` and numeric values, make sure that you understand the conversion method that you select.
7171

@@ -99,7 +99,7 @@ There is always a risk in using narrowing conversions, because they can fail at
9999

100100
The [String Data Type](../../../language-reference/data-types/string-data-type.md) participates in very few widening conversions. `String` widens only to itself and `Object`, and only `Char` and `Char()` (a `Char` array) widen to `String`. This is because `String` variables and constants can contain values that other data types cannot contain.
101101

102-
When the type checking switch ([Option Strict Statement](../../../language-reference/statements/option-strict-statement.md)) is `On`, the compiler disallows all implicit narrowing conversions. This includes those involving `String`. Your code can still use conversion keywords such as `CStr` and [CType Function](../../../language-reference/functions/ctype-function.md), which direct the .NET Framework to attempt the conversion.
102+
When the type checking switch ([Option Strict Statement](../../../language-reference/statements/option-strict-statement.md)) is `On`, the compiler disallows all implicit narrowing conversions. This includes those involving `String`. Your code can still use conversion keywords such as `CStr` and [CType Operator](../../../language-reference/functions/ctype-function.md), which direct the .NET Framework to attempt the conversion.
103103

104104
> [!NOTE]
105105
> The narrowing-conversion error is suppressed for conversions from the elements in a `For Each…Next` collection to the loop control variable. For more information and examples, see the "Narrowing Conversions" section in [For Each...Next Statement](../../../language-reference/statements/for-each-next-statement.md).

docs/visual-basic/programming-guide/language-features/procedures/how-to-define-a-conversion-operator.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ ms.assetid: 54203dfa-c24b-463f-9942-d5153e89e762
1515

1616
If you have defined a class or structure, you can define a type conversion operator between the type of your class or structure and another data type (such as `Integer`, `Double`, or `String`).
1717

18-
Define the type conversion as a [CType Function](../../../language-reference/functions/ctype-function.md) procedure within the class or structure. All conversion procedures must be `Public Shared`, and each one must specify either [Widening](../../../language-reference/modifiers/widening.md) or [Narrowing](../../../language-reference/modifiers/narrowing.md).
18+
Define the type conversion as a [CType Operator](../../../language-reference/functions/ctype-function.md) procedure within the class or structure. All conversion procedures must be `Public Shared`, and each one must specify either [Widening](../../../language-reference/modifiers/widening.md) or [Narrowing](../../../language-reference/modifiers/narrowing.md).
1919

2020
Defining an operator on a class or structure is also called *overloading* the operator.
2121

docs/visual-basic/toc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ items:
368368
items:
369369
- name: Return Values for the CStr Function
370370
href: language-reference/functions/return-values-for-the-cstr-function.md
371-
- name: CType Function
371+
- name: CType Operator
372372
href: language-reference/functions/ctype-function.md
373373
- name: Modifiers
374374
href: language-reference/modifiers/index.md

0 commit comments

Comments
 (0)