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: MacOS/NativeTypeConversion.cs
+38-14Lines changed: 38 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -9,11 +9,13 @@
9
9
namespaceCarinaStudio.MacOS;
10
10
11
11
/// <summary>
12
-
/// Conversion between native and CLR types.
12
+
/// Conversion between native and CLR types. The class is not supposed to be used directly. It is used for internal type conversion and code generation.
13
13
/// </summary>
14
-
staticclassNativeTypeConversion
14
+
publicstaticclassNativeTypeConversion
15
15
{
16
-
// Convert from native parameter to CLR parameter.
16
+
/// <summary>
17
+
/// Convert from native parameter to CLR parameter.
18
+
/// </summary>
17
19
#if NET7_0_OR_GREATER
18
20
[RequiresDynamicCode("Dynamic code generation is required for checking native type.")]
19
21
#endif
@@ -59,7 +61,9 @@ static class NativeTypeConversion
59
61
}
60
62
61
63
62
-
// Convert from native value to CLR value.
64
+
/// <summary>
65
+
/// Convert from native value to CLR value.
66
+
/// </summary>
63
67
#if NET7_0_OR_GREATER
64
68
[RequiresDynamicCode("Dynamic code generation is required for converting to CLR value type.")]
65
69
#endif
@@ -179,8 +183,10 @@ static class NativeTypeConversion
179
183
thrownewNotSupportedException($"Cannot convert native value to {targetType.Name}.");
180
184
}
181
185
182
-
183
-
// Convert from Objective-C type encoding.
186
+
187
+
/// <summary>
188
+
/// Convert from Objective-C type encoding.
189
+
/// </summary>
184
190
#if NET7_0_OR_GREATER
185
191
[RequiresDynamicCode("Dynamic code generation is required for creating Objective-C type encoding.")]
186
192
#endif
@@ -381,7 +387,9 @@ static Type FromTypeEncoding(ReadOnlySpan<char> typeEncoding, out int elementCou
381
387
}
382
388
383
389
384
-
// Get size of native value in bytes.
390
+
/// <summary>
391
+
/// Get size of native value in bytes.
392
+
/// </summary>
385
393
#if NET7_0_OR_GREATER
386
394
[RequiresDynamicCode("Dynamic code generation is required for checking native type.")]
387
395
#endif
@@ -410,7 +418,9 @@ public static int GetNativeValueSize(Type type)
410
418
}
411
419
412
420
413
-
// Check whether given type is the native type or not.
421
+
/// <summary>
422
+
/// Check whether given type is the native type or not.
423
+
/// </summary>
414
424
#if NET7_0_OR_GREATER
415
425
[RequiresDynamicCode("Dynamic code generation is required for checking native type.")]
416
426
#endif
@@ -443,8 +453,10 @@ public static bool IsNativeType(Type type)
443
453
},false);
444
454
}
445
455
446
-
447
-
// Convert from CLR parameter to native parameter.
456
+
457
+
/// <summary>
458
+
/// Convert from CLR parameter to native parameter.
459
+
/// </summary>
448
460
#if NET7_0_OR_GREATER
449
461
[RequiresDynamicCode("Dynamic code generation is required for checking native type.")]
450
462
#endif
@@ -475,8 +487,10 @@ public static object ToNativeParameter(object? value)
475
487
thrownewNotSupportedException($"Cannot convert from {value.GetType().Name} to native value.");
476
488
}
477
489
478
-
479
-
// Convert from CLR object to native value.
490
+
491
+
/// <summary>
492
+
/// Convert from CLR object to native value.
493
+
/// </summary>
480
494
#if NET7_0_OR_GREATER
481
495
[RequiresDynamicCode("Dynamic code generation is required for converting from CLR value type.")]
482
496
#endif
@@ -606,7 +620,9 @@ public static unsafe int ToNativeValue(object? obj, byte* valuePtr)
606
620
}
607
621
608
622
609
-
// Convert to corresponding native type.
623
+
/// <summary>
624
+
/// Convert to corresponding native type.
625
+
/// </summary>
610
626
#if NET7_0_OR_GREATER
611
627
[RequiresDynamicCode("Dynamic code generation is required for checking native type.")]
612
628
#endif
@@ -624,9 +640,14 @@ public static Type ToNativeType(Type type)
0 commit comments