Files
RobustToolbox/Robust.Shared/Analyzers/PreferOtherTypeAttribute.cs
Tayrtahn b6548c870c Add analyzer/fixer for replacing ProtoId<EntityPrototype> with EntProtoId (#5312)
* Add PreferOtherTypeAttribute, analyzer, and test.

* nullable enable

* Add nuget package for CodeFix verifier

* Add fixer for PreferOtherType

* Rename arguments

* Adjust diagnostic message

* Move attribute lookup
2024-07-23 19:01:43 +02:00

19 lines
584 B
C#

using System;
#if ROBUST_ANALYZERS_IMPL
namespace Robust.Shared.Analyzers.Implementation;
#else
namespace Robust.Shared.Analyzers;
#endif
/// <summary>
/// Marks that use of a generic Type should be replaced with a specific other Type
/// when the type argument T is a certain Type.
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)]
public sealed class PreferOtherTypeAttribute(Type genericType, Type replacementType) : Attribute
{
public readonly Type GenericArgument = genericType;
public readonly Type ReplacementType = replacementType;
}