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
C2039 can also occur if you attempt to access a default indexer incorrectly. The following sample defines a component authored in C#.
59
+
C2039 can also occur if you attempt to access a default indexer incorrectly. To demonstrate, this code defines a C# component that is used by the C++/CLI code that follows:
61
60
62
-
```
61
+
```c#
63
62
// C2039_d.cs
64
63
// compile with: /target:library
65
64
// a C# program
@@ -72,7 +71,7 @@ public class B {
72
71
};
73
72
```
74
73
75
-
The following sample generates C2039.
74
+
The following sample generates C2039 when it uses the previously defined C# component's default indexer incorrectly from C++/CLI:
76
75
77
76
```cpp
78
77
// C2039_e.cpp
@@ -89,7 +88,7 @@ int main() {
89
88
}
90
89
```
91
90
92
-
C2039 can also occur if you use generics. The following sample generates C2039.
91
+
C2039 can also occur if you use generics. The following sample generates C2039:
93
92
94
93
```cpp
95
94
// C2039_f.cpp
@@ -114,7 +113,7 @@ int main() {
114
113
115
114
C2039 can occur when you try to release managed or unmanaged resources. For more information, see [Destructors and finalizers](../../dotnet/how-to-define-and-consume-classes-and-structs-cpp-cli.md#BKMK_Destructors_and_finalizers).
0 commit comments