-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5da99e1
commit 23752b4
Showing
5 changed files
with
66 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
namespace MinimalUtility | ||
{ | ||
/// <summary> | ||
/// <see cref="System.FlagsAttribute"/>の拡張版. | ||
/// </summary> | ||
/// <remarks> | ||
/// 以下のようなコードを自動生成して、foreach文で保持フラグの列挙を可能にする.その必要がなければ、<see cref="System.FlagsAttribute"/>を使用推奨. | ||
/// </remarks> | ||
/// <example> | ||
/// <code> | ||
/// <![CDATA[ | ||
/// using System.Runtime.CompilerServices; | ||
/// | ||
/// namespace MinimalUtility | ||
/// { | ||
/// internal static class HogeExtensions | ||
/// { | ||
/// | ||
/// [MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
/// public static Enumerator GetEnumerator(this Hoge value) | ||
/// { | ||
/// return new Enumerator(value); | ||
/// } | ||
/// | ||
/// public struct Enumerator | ||
/// { | ||
/// private Hoge value; | ||
/// | ||
/// public Hoge Current { get; private set; } | ||
/// | ||
/// internal Enumerator(Hoge value) | ||
/// { | ||
/// this.value = value; | ||
/// Current = default; | ||
/// } | ||
/// | ||
/// /// <inheritdoc/> | ||
/// public bool MoveNext() | ||
/// { | ||
/// var flags = (int)value; | ||
/// if (flags == 0) return false; | ||
/// Current = (Hoge)(flags & -flags); // get lowest flag | ||
/// value &= ~Current; | ||
/// return true; | ||
/// } | ||
/// } | ||
/// } | ||
/// } | ||
/// ]]> | ||
/// </code> | ||
/// </example> | ||
public sealed class FlagsExAttribute : System.FlagsAttribute | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="FlagsExAttribute"/> class. | ||
/// </summary> | ||
public FlagsExAttribute() : base() | ||
{ | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file modified
BIN
+0 Bytes
(100%)
Packages/MinimalUtility/Runtime/Roslyn/MinimalUtility.SourceGenerator.dll
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters