-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAgnosticJSMarshalAsAttribute.cs
More file actions
19 lines (17 loc) · 965 Bytes
/
Copy pathAgnosticJSMarshalAsAttribute.cs
File metadata and controls
19 lines (17 loc) · 965 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
using System.Runtime.InteropServices.JavaScript;
namespace SerratedSharp.SerratedJSInterop;
/// <summary>
/// Agnostic stand-in for <see cref="JSMarshalAsAttribute{T}"/>. The source generator
/// emits <c>[JSMarshalAs<T>]</c> (or <c>[return: JSMarshalAs<T>]</c>) in the
/// generated code by dropping the "Agnostic" prefix. Use the same type arguments as
/// <see cref="JSType"/> (e.g. <see cref="JSType.Any"/>, <see cref="JSType.Array{T}"/>).
/// </summary>
/// <typeparam name="T">One of the types defined in <see cref="JSType"/>.</typeparam>
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false, AllowMultiple = false)]
public sealed class AgnosticJSMarshalAsAttribute<T> : Attribute where T : JSType
{
/// <summary>
/// Initializes a new instance configured by the generic parameter (same as <see cref="JSMarshalAsAttribute{T}"/>).
/// </summary>
public AgnosticJSMarshalAsAttribute() { }
}