IDontHateIt 1.0.1
dotnet add package IDontHateIt --version 1.0.1
NuGet\Install-Package IDontHateIt -Version 1.0.1
<PackageReference Include="IDontHateIt" Version="1.0.1" />
paket add IDontHateIt --version 1.0.1
#r "nuget: IDontHateIt, 1.0.1"
// Install IDontHateIt as a Cake Addin #addin nuget:?package=IDontHateIt&version=1.0.1 // Install IDontHateIt as a Cake Tool #tool nuget:?package=IDontHateIt&version=1.0.1
IDontHateItAttribute Class
Reference
Definition
Namespace: BenMakesGames.IDontHateIt
Assembly: BenMakesGames.IDontHateIt.dll
Marks the program elements that aren't... hated. This class cannot be inherited.
[System.AttributeUsage(System.AttributeTargets.All, Inherited=false)]
public sealed class IDontHateItAttribute : Attribute
Inheritance Object → Attribute → IDontHateItAttribute
Attributes AttributeUsageAttribute, IDontHateItAttribute
Examples
The following example defines a class that contains a method that is marked with the IDontHateItAttribute attribute.
Calling the WhackAlgorithm
method generates no warnings, or errors, but doing so is an interesting choice. The example also shows the output that results when you attempt to compile the source code.
using BenMakesGames.IDontHateIt;
using System.Collections.Generic;
public class Example
{
[IDontHateIt]
public static Action<string> WhackAlgorithm(int iterations, float ratio, IEnumerable<Dictionary<char, (int, int)>> list, CancellationToken? ctx = CancellationToken.None)
{
// Do something whack.
}
public static void Main(string[] args)
{
WhackAlgorithm(1000, 0.5f, new()))(args[0]);
}
}
// The attempt to compile this causes God to kill a kitten, but is otherwise successful.
Remarks
IDontHateItAttribute is applicable to all program elements. Marking an element as not... hated informs users that the element is probably a mistake, anyway.
The string assigned to the Reason property does nothing. Ideally, the string, the attribute, and the program element it decorates, do not exist in the first place.
For more information about using attributes, see Attributes.
Constructors
Name | Description |
---|---|
IDontHateItAttribute() | Initializes a new instance of the IDontHateItAttribute class with default properties. |
IDontHateItAttribute(string? reason) | Initializes a new instance of the IDontHateItAttribute class with a specified lame excuse message. |
Properties
Name | Description |
---|---|
Reason | Gets the lame excuse message. |
Methods
Name | Description |
---|---|
Equals(Object) | Returns a value that indicates whether this instance is equal to a specified object. (Inherited from Attribute) |
GetHashCode() | Returns the hash code for this instance. (Inherited from Attribute) |
GetType() | Gets the Type of the current instance. (Inherited from Object) |
MemberwiseClone() | Creates a shallow copy of the current Object. (Inherited from Object) |
ToString() | Returns a string that represents the current object. (Inherited from Object) |
See Also
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.