Skip to content

Commit

Permalink
Add sample code
Browse files Browse the repository at this point in the history
  • Loading branch information
kochounoyume committed Jan 6, 2025
1 parent ce92d6c commit baa3514
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
33 changes: 33 additions & 0 deletions Packages/MinimalUtility/Runtime/EqualityComparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,39 @@ public static class EqualityComparer
/// <summary>
/// 指定した比較処理を使用して<see cref="EqualityComparer{T}"/>を生成します.
/// </summary>
///<example>
///<code>
/// <![CDATA[
/// using System.Collections.Generic;
/// using MinimalUtility;
///
/// public enum Fruits : int
/// {
/// Apple,
/// Orange,
/// Banana,
/// }
///
/// public class EqualityComparerFactoryExample
/// {
/// private readonly Dictionary<Fruits, string> _fruits;
///
/// public EqualityComparerFactoryExample()
/// {
/// var equalityComparer = EqualityComparer.Create<Fruits>(
/// static (x, y) => (int) x == (int) y,
/// static x => ((int) x).GetHashCode());
/// _fruits = new Dictionary<Fruits, string>(3, equalityComparer)
/// {
/// {Fruits.Apple, "Apple"},
/// {Fruits.Orange, "Orange"},
/// {Fruits.Banana, "Banana"},
/// };
/// }
/// }
/// ]]>
/// </code>
/// </example>
/// <param name="equals"><see cref="EqualityComparer{T}.Equals(T, T)"/>に使用する処理.</param>
/// <param name="getHashCode"><see cref="EqualityComparer{T}.GetHashCode(T)"/>に使用する処理.</param>
/// <typeparam name="T">比較対象の型.</typeparam>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public static ReadOnlyMemory<T> GetComponentsInOnlyChildren<T>(this Component se
///
/// public class SafeGetComponentExample : MonoBehaviour
/// {
/// private HingeJoint hinge;
/// private HingeJoint _hinge;
///
/// private void Update()
/// {
Expand Down

0 comments on commit baa3514

Please sign in to comment.