mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-03 02:27:08 +02:00
41 lines
1.2 KiB
C#
41 lines
1.2 KiB
C#
using System;
|
|
|
|
#if ROBUST_ANALYZERS_IMPL
|
|
namespace Robust.Shared.Analyzers.Implementation;
|
|
#else
|
|
namespace Robust.Shared.Analyzers;
|
|
#endif
|
|
|
|
/// <summary>
|
|
/// Indicates that the user should prefer to use non-generic, special methods for the given generic type arguments.
|
|
/// </summary>
|
|
/// <example>
|
|
/// <code>
|
|
/// public sealed MyClass
|
|
/// {
|
|
/// [PreferNonGenericVariantFor(typeof(Cupcake))]
|
|
/// public static string DescribeFood<T>(T food);
|
|
/// public static string DescribeCupcake(Cupcake food);
|
|
/// }
|
|
/// <br/>
|
|
/// // Warning RA0030: Use the non-generic variant of this method for type Cupcake.
|
|
/// MyClass.DescribeFood<Cupcake>(new Cupcake());
|
|
/// <br/>
|
|
/// // No warning
|
|
/// MyClass.DescribeCupcake(new Cupcake());
|
|
/// </code>
|
|
/// </example>
|
|
[AttributeUsage(AttributeTargets.Method)]
|
|
public sealed class PreferNonGenericVariantForAttribute : Attribute
|
|
{
|
|
/// <summary>
|
|
/// The types to recommend using non-generic methods for.
|
|
/// </summary>
|
|
public readonly Type[] ForTypes;
|
|
|
|
public PreferNonGenericVariantForAttribute(params Type[] forTypes)
|
|
{
|
|
ForTypes = forTypes;
|
|
}
|
|
}
|