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/dotnet/how-to-extend-the-marshaling-library.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -95,7 +95,7 @@ namespace msclr {
95
95
}
96
96
```
97
97
98
-
## Example extending the marshaling library
98
+
## Example extending marshaling library
99
99
100
100
The following example extends the marshaling library with a conversion that does not require a context. In this example, the code converts the employee information from a native data type to a managed data type.
101
101
@@ -157,7 +157,7 @@ Managed address: 123 Main Street
157
157
Managed zip code: 98111
158
158
```
159
159
160
-
## Example converting the employee information
160
+
## Example converting employee information
161
161
162
162
The following example converts the employee information from a managed data type to a native data type. This conversion requires a marshaling context.
Copy file name to clipboardExpand all lines: docs/dotnet/how-to-marshal-ansi-strings-using-cpp-interop.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ This topic demonstrates how ANSI strings can be passed using C++ Interop, but th
15
15
16
16
The following code examples use the [managed, unmanaged](../preprocessor/managed-unmanaged.md) #pragma directives to implement managed and unmanaged functions in the same file, but these functions interoperate in the same manner if defined in separate files. Because files containing only unmanaged functions do not need to be compiled with [/clr (Common Language Runtime Compilation)](../build/reference/clr-common-language-runtime-compilation.md), they can retain their performance characteristics.
17
17
18
-
## Example passing an ANSI string
18
+
## Example passing ANSI string
19
19
20
20
The example demonstrates passing an ANSI string from a managed to an unmanaged function using <xref:System.Runtime.InteropServices.Marshal.StringToHGlobalAnsi%2A>. This method allocates memory on the unmanaged heap and returns the address after performing the conversion. This means that no pinning is necessary (because memory on the GC heap is not being passed to the unmanaged function) and that the IntPtr returned from <xref:System.Runtime.InteropServices.Marshal.StringToHGlobalAnsi%2A> must be explicitly released or a memory leak results.
21
21
@@ -49,7 +49,7 @@ int main() {
49
49
}
50
50
```
51
51
52
-
## Example of data marshaling required to access an ANSI string
52
+
## Example of data marshaling required to access ANSI string
53
53
54
54
The following example demonstrates the data marshaling required to access an ANSI string in a managed function that is called by an unmanaged function. The managed function, on receiving the native string, can either use it directly or convert it to a managed string using the <xref:System.Runtime.InteropServices.Marshal.PtrToStringAnsi%2A> method, as shown.
Copy file name to clipboardExpand all lines: docs/dotnet/how-to-marshal-arrays-using-cpp-interop.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ This topic demonstrates one facet of Visual C++ interoperability. For more infor
11
11
12
12
The following code examples use the [managed, unmanaged](../preprocessor/managed-unmanaged.md) #pragma directives to implement managed and unmanaged functions in the same file, but these functions interoperate in the same manner if defined in separate files. Files containing only unmanaged functions do not need to be compiled with [/clr (Common Language Runtime Compilation)](../build/reference/clr-common-language-runtime-compilation.md).
13
13
14
-
## Example passing a managed array to an unmanaged function
14
+
## Example passing managed array to unmanaged function
15
15
16
16
The following example demonstrates how to pass a managed array to an unmanaged function. The managed function uses [pin_ptr (C++/CLI)](../extensions/pin-ptr-cpp-cli.md) to suppress garbage collection for the array before calling the unmanaged function. By providing the unmanaged function with a pinned pointer into the GC heap, the overhead of making a copy of the array can be avoided. To demonstrate that the unmanaged function is accessing GC heap memory, it modifies the contents of the array and the changes are reflected when the managed function resumes control.
17
17
@@ -70,7 +70,7 @@ int main() {
70
70
}
71
71
```
72
72
73
-
## Example passing an unmanaged array to a managed function
73
+
## Example passing unmanaged array to managed function
74
74
75
75
The following example demonstrates passing an unmanaged array to a managed function. The managed function accesses the array memory directly (as opposed to creating a managed array and copying the array content), which allows changes made by the managed function to be reflected in the unmanaged function when it regains control.
Copy file name to clipboardExpand all lines: docs/dotnet/how-to-marshal-callbacks-and-delegates-by-using-cpp-interop.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ This topic demonstrates the marshalling of callbacks and delegates (the managed
11
11
12
12
The following code examples use the [managed, unmanaged](../preprocessor/managed-unmanaged.md) #pragma directives to implement managed and unmanaged functions in the same file, but the functions could also be defined in separate files. Files containing only unmanaged functions do not need to be compiled with the [/clr (Common Language Runtime Compilation)](../build/reference/clr-common-language-runtime-compilation.md).
13
13
14
-
## Example configuring an unmanaged API to trigger a managed delegate
14
+
## Example configuring unmanaged API to trigger managed delegate
15
15
16
16
The following example demonstrates how to configure an unmanaged API to trigger a managed delegate. A managed delegate is created and one of the interop methods, <xref:System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate%2A>, is used to retrieve the underlying entry point for the delegate. This address is then passed to the unmanaged function, which calls it with no knowledge of the fact that it is implemented as a managed function.
17
17
@@ -65,7 +65,7 @@ int main() {
65
65
}
66
66
```
67
67
68
-
## Example with the function pointer stored by the unmanaged API
68
+
## Example with function pointer stored by unmanaged API
69
69
70
70
The following example is similar to the previous example, but in this case the provided function pointer is stored by the unmanaged API, so it can be invoked at any time, requiring that garbage collection be suppressed for an arbitrary length of time. As a result, the following example uses a global instance of <xref:System.Runtime.InteropServices.GCHandle> to prevent the delegate from being relocated, independent of function scope. As discussed in the first example, using pin_ptr is unnecessary for these examples, but in this case wouldn't work anyway, as the scope of a pin_ptr is limited to a single function.
Copy file name to clipboardExpand all lines: docs/dotnet/how-to-marshal-com-strings-using-cpp-interop.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ This topic demonstrates how a BSTR (the basic string format favored in COM progr
15
15
16
16
The following code examples use the [managed, unmanaged](../preprocessor/managed-unmanaged.md) #pragma directives to implement managed and unmanaged functions in the same file, but these functions interoperate in the same manner if defined in separate files. Files containing only unmanaged functions do not need to be compiled with [/clr (Common Language Runtime Compilation)](../build/reference/clr-common-language-runtime-compilation.md).
17
17
18
-
## Example passing a BSTR from a managed to an unmanaged function
18
+
## Example passing BSTR from managed to unmanaged function
19
19
20
20
The following example demonstrates how a BSTR (a string format used in COM programming) can be passed from a managed to an unmanaged function. The calling managed function uses <xref:System.Runtime.InteropServices.Marshal.StringToBSTR%2A> to obtain the address of a BSTR representation of the contents of a .NET System.String. This pointer is pinned using [pin_ptr (C++/CLI)](../extensions/pin-ptr-cpp-cli.md) to ensure that its physical address is not changed during a garbage collection cycle while the unmanaged function executes. The garbage collector is prohibited from moving the memory until the [pin_ptr (C++/CLI)](../extensions/pin-ptr-cpp-cli.md) goes out of scope.
21
21
@@ -52,7 +52,7 @@ int main() {
52
52
}
53
53
```
54
54
55
-
## Example passing a BSTR from a an unmanaged to a managed function
55
+
## Example passing BSTR from unmanaged to managed function
56
56
57
57
The following example demonstrates how a BSTR can be passed from an unmanaged to an unmanaged function. The receiving managed function can either use the string in as a BSTR or use <xref:System.Runtime.InteropServices.Marshal.PtrToStringBSTR%2A> to convert it to a <xref:System.String> for use with other managed functions. Because the memory representing the BSTR is allocated on the unmanaged heap, no pinning is necessary, because there is no garbage collection on the unmanaged heap.
Copy file name to clipboardExpand all lines: docs/dotnet/how-to-marshal-structures-using-cpp-interop.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ This topic demonstrates one facet of Visual C++ interoperability. For more infor
11
11
12
12
The following code examples use the [managed, unmanaged](../preprocessor/managed-unmanaged.md) #pragma directives to implement managed and unmanaged functions in the same file, but these functions interoperate in the same manner if defined in separate files. Files containing only unmanaged functions do not need to be compiled with [/clr (Common Language Runtime Compilation)](../build/reference/clr-common-language-runtime-compilation.md).
13
13
14
-
## Example passing a structure from a managed to an unmanaged function
14
+
## Example passing structure from managed to unmanaged function
15
15
16
16
The following example demonstrates passing a structure from a managed to an unmanaged function, both by value and by reference. Because the structure in this example contains only simple, intrinsic data types (see [Blittable and Non-Blittable Types](/dotnet/framework/interop/blittable-and-non-blittable-types)), no special marshaling is required. To marshal non-blittable structures, such as those that contain pointers, see [How to: Marshal Embedded Pointers Using C++ Interop](../dotnet/how-to-marshal-embedded-pointers-using-cpp-interop.md).
17
17
@@ -69,7 +69,7 @@ int main() {
69
69
}
70
70
```
71
71
72
-
## Example passing a structure from an unmanaged to a managed function
72
+
## Example passing structure from unmanaged to managed function
73
73
74
74
The following example demonstrates passing a structure from an unmanaged to a managed function, both by value and by reference. Because the structure in this example contains only simple, intrinsic data types (see [Blittable and Non-Blittable Types](/dotnet/framework/interop/blittable-and-non-blittable-types)), no special marshalling is required. To marshal non-blittable structures, such as those that contain pointers, see [How to: Marshal Embedded Pointers Using C++ Interop](../dotnet/how-to-marshal-embedded-pointers-using-cpp-interop.md).
Copy file name to clipboardExpand all lines: docs/dotnet/how-to-marshal-unicode-strings-using-cpp-interop.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ This topic demonstrates how Unicode strings can be passed from a managed to an u
17
17
18
18
-[How to: Marshal COM Strings Using C++ Interop](../dotnet/how-to-marshal-com-strings-using-cpp-interop.md)
19
19
20
-
## Example passing a Unicode string from a managed to an unmanaged function
20
+
## Example passing Unicode string from managed to unmanaged function
21
21
22
22
To pass a Unicode string from a managed to an unmanaged function, the PtrToStringChars function (declared in Vcclr.h) can be used to access in the memory where the managed string is stored. Because this address will be passed to a native function, it is important that the memory be pinned with [pin_ptr (C++/CLI)](../extensions/pin-ptr-cpp-cli.md) to prevent the string data from being relocated, should a garbage collection cycle take place while the unmanaged function executes.
23
23
@@ -50,7 +50,7 @@ int main() {
50
50
}
51
51
```
52
52
53
-
## Example with data marshaling required to access a Unicode string
53
+
## Example with data marshaling required to access Unicode string
54
54
55
55
The following example demonstrates the data marshaling required to access a Unicode string in a managed function called by an unmanaged function. The managed function, on receiving the native Unicode string, converts it to a managed string using the <xref:System.Runtime.InteropServices.Marshal.PtrToStringUni%2A> method.
Generics authored in one .NET (or UWP) language may be used in other languages. Unlike templates, a generic in a compiled assembly still remains generic. Thus, one may instantiate the generic type in a different assembly and even in a different language than the assembly in which the generic type was defined.
11
11
12
-
## Example of a generic class defined in C#
12
+
## Example of generic class defined in C#
13
13
14
14
### Description
15
15
@@ -73,7 +73,7 @@ public class CircularList<ItemType> {
Copy file name to clipboardExpand all lines: docs/extensions/generic-classes-cpp-cli.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -272,7 +272,7 @@ The signature of a non-generic method can include one or more type parameters of
272
272
273
273
The body of such methods can also use these type parameters.
274
274
275
-
## Example declaring a non-generic method
275
+
## Example declaring non-generic method
276
276
277
277
The following example declares a non-generic method, `ProtectData`, inside a generic class, `MyClass<ItemType>`. The method uses the class type parameter `ItemType` in its signature in an open constructed type.
278
278
@@ -443,7 +443,7 @@ Since there is no way to refer to the outer type parameter, the compiler will pr
443
443
444
444
When constructed nested generic types are named, the type parameter for the outer type is not included in the type parameter list for the inner type, even though the inner type is implicitly parameterized by the outer type's type parameter. In the above case, a name of a constructed type would be `Outer<int>::Inner<string>`.
445
445
446
-
## Example building and reading a linked list
446
+
## Example building and reading linked list
447
447
448
448
The following example demonstrates building and reading a linked list using nested types in generic classes.
449
449
@@ -546,7 +546,7 @@ Reading nodes:
546
546
547
547
- Properties, events, indexers and operators cannot themselves be parameterized.
548
548
549
-
## Example declaring an instance property
549
+
## Example declaring instance property
550
550
551
551
This example shows declarations of an instance property within a generic class.
552
552
@@ -586,7 +586,7 @@ int main() {
586
586
John, 234
587
587
```
588
588
589
-
## Example of a generic class with an event
589
+
## Example of generic class with event
590
590
591
591
The next example shows a generic class with an event.
592
592
@@ -653,7 +653,7 @@ int main() {
653
653
654
654
The rules for declaring and using generic structs are the same as those for generic classes, except for the differences noted in the Visual C++ language reference.
655
655
656
-
## Example declaring a generic struct
656
+
## Example declaring generic struct
657
657
658
658
The following example declares a generic struct, `MyGenStruct`, with one field, `myField`, and assigns values of different types (**`int`**, **`double`**, `String^`) to this field.
0 commit comments