2
2
// The .NET Foundation licenses this file to you under the MIT license.
3
3
// See the LICENSE file in the project root for more information.
4
4
5
+ #if NET
6
+
5
7
using System ;
6
8
7
9
namespace Microsoft . Data . SqlClient
8
10
{
9
- // this structure is used for transporting packet handle references between the TdsParserStateObject
10
- // base class and Managed or Native implementations.
11
- // It prevents the native IntPtr type from being boxed and prevents the need to cast from object which loses compile time type safety
12
- // It carries type information so that assertions about the type of handle can be made in the implemented abstract methods
13
- // it is a ref struct so that it can only be used to transport the handles and not store them
11
+ // This structure is used for transporting packet handle references between the
12
+ // TdsParserStateObject base class and Managed or Native implementations.
13
+ // It prevents the native IntPtr type from being boxed and prevents the need to cast from
14
+ // object which loses compile time type safety.
15
+ // It carries type information so that assertions about the type of handle can be made in the
16
+ // implemented abstract methods.
17
+ // It is a ref struct so that it can only be used to transport the handles and not store them
14
18
15
19
// N.B. If you change this type you must also change the version for the other platform
16
20
@@ -20,10 +24,9 @@ internal readonly ref struct PacketHandle
20
24
public const int NativePacketType = 2 ;
21
25
public const int ManagedPacketType = 3 ;
22
26
23
- public readonly IntPtr NativePointer ;
24
- public readonly SNIPacket NativePacket ;
25
-
26
27
public readonly SNI . SNIPacket ManagedPacket ;
28
+ public readonly SNIPacket NativePacket ;
29
+ public readonly IntPtr NativePointer ;
27
30
public readonly int Type ;
28
31
29
32
private PacketHandle ( IntPtr nativePointer , SNIPacket nativePacket , SNI . SNIPacket managedPacket , int type )
@@ -34,12 +37,17 @@ private PacketHandle(IntPtr nativePointer, SNIPacket nativePacket, SNI.SNIPacket
34
37
NativePacket = nativePacket ;
35
38
}
36
39
37
- public static PacketHandle FromManagedPacket ( SNI . SNIPacket managedPacket ) => new PacketHandle ( default , default , managedPacket , ManagedPacketType ) ;
40
+ public static PacketHandle FromManagedPacket ( SNI . SNIPacket managedPacket ) =>
41
+ new PacketHandle ( default , default , managedPacket , ManagedPacketType ) ;
38
42
39
- public static PacketHandle FromNativePointer ( IntPtr nativePointer ) => new PacketHandle ( nativePointer , default , default , NativePointerType ) ;
43
+ public static PacketHandle FromNativePointer ( IntPtr nativePointer ) =>
44
+ new PacketHandle ( nativePointer , default , default , NativePointerType ) ;
40
45
41
- public static PacketHandle FromNativePacket ( SNIPacket nativePacket ) => new PacketHandle ( default , nativePacket , default , NativePacketType ) ;
46
+ public static PacketHandle FromNativePacket ( SNIPacket nativePacket ) =>
47
+ new PacketHandle ( default , nativePacket , default , NativePacketType ) ;
42
48
43
49
44
50
}
45
- }
51
+ }
52
+
53
+ #endif
0 commit comments