Skip to content

Commit 2ae5d7a

Browse files
authored
Add new API docs for System.Runtime.InteropServices (#106208)
1 parent 81d7ff1 commit 2ae5d7a

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshalling/ReadOnlySpanMarshaller.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ public void FromUnmanaged(TUnmanagedElement* unmanaged)
188188
/// <summary>
189189
/// Returns the managed value representing the native array.
190190
/// </summary>
191+
/// <returns>A span over managed values of the array.</returns>
191192
public ReadOnlySpan<T> ToManaged()
192193
{
193194
return new ReadOnlySpan<T>(_managedValues!);
@@ -196,6 +197,7 @@ public ReadOnlySpan<T> ToManaged()
196197
/// <summary>
197198
/// Returns a span that points to the memory where the unmanaged elements of the array are stored.
198199
/// </summary>
200+
/// <param name="numElements">The number of elements in the array.</param>
199201
/// <returns>A span over unmanaged values of the array.</returns>
200202
public ReadOnlySpan<TUnmanagedElement> GetUnmanagedValuesSource(int numElements)
201203
{
@@ -205,6 +207,7 @@ public ReadOnlySpan<TUnmanagedElement> GetUnmanagedValuesSource(int numElements)
205207
/// <summary>
206208
/// Returns a span that points to the memory where the managed elements of the array should be stored.
207209
/// </summary>
210+
/// <param name="numElements">The number of elements in the array.</param>
208211
/// <returns>A span where managed values of the array should be stored.</returns>
209212
public Span<T> GetManagedValuesDestination(int numElements)
210213
{

src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Swift/SwiftTypes.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public SwiftSelf(void* value)
4242
/// Represents the Swift 'self' context when the argument is Swift frozen struct T, which is either enregistered into multiple registers,
4343
/// or passed by reference in the 'self' register.
4444
/// </summary>
45+
/// <typeparam name="T">The type of the frozen struct to pass in the 'self' context.</typeparam>
4546
/// <remarks>
4647
/// <para>
4748
/// This struct is used to pass the Swift frozen struct T to Swift functions in the context of interop with .NET.

src/libraries/System.Runtime.InteropServices/src/System/Runtime/InteropServices/Marshalling/ComVariantMarshaller.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ public static partial class ComVariantMarshaller
2222
// VARIANT_BOOL constants.
2323
private const short VARIANT_TRUE = -1;
2424
private const short VARIANT_FALSE = 0;
25+
26+
/// <summary>
27+
/// Converts a managed object to an unmanaged <see cref="ComVariant"/>.
28+
/// </summary>
29+
/// <param name="managed">The managed object.</param>
30+
/// <returns>A <see cref="ComVariant" /> that represents the provided managed object.</returns>
31+
/// <exception cref="ArgumentException">The type of <paramref name="managed"/> is not supported.</exception>
2532
public static ComVariant ConvertToUnmanaged(object? managed)
2633
{
2734
if (managed is null)
@@ -103,6 +110,12 @@ private static unsafe bool TryCreateOleVariantForInterfaceWrapper(object managed
103110
}
104111
#pragma warning restore CA1416 // Validate platform compatibility
105112

113+
/// <summary>
114+
/// Converts an unmanaged <see cref="ComVariant"/> to a managed object.
115+
/// </summary>
116+
/// <param name="unmanaged">The unmanaged variant.</param>
117+
/// <returns>A managed object that represents the same value as <paramref name="unmanaged"/>.</returns>
118+
/// <exception cref="ArgumentException">The type of data stored in <paramref name="unmanaged"/> is not supported.</exception>
106119
public static unsafe object? ConvertToManaged(ComVariant unmanaged)
107120
{
108121
#pragma warning disable CS0618 // Type or member is obsolete
@@ -195,6 +208,10 @@ private static unsafe bool TryCreateOleVariantForInterfaceWrapper(object managed
195208
#pragma warning restore CS0618 // Type or member is obsolete
196209
}
197210

211+
/// <summary>
212+
/// Disposes the unmanaged <see cref="ComVariant"/>.
213+
/// </summary>
214+
/// <param name="unmanaged">The object to dispose.</param>
198215
public static void Free(ComVariant unmanaged) => unmanaged.Dispose();
199216

200217
/// <summary>

0 commit comments

Comments
 (0)