< Summary

Information
Class: MyNet.Collections.ImmediateCollectionEventDispatcher
Assembly: MyNet.Collections
File(s): https://raw.githubusercontent.com/sandre58/MyNet/85372080fe102cd9ee155ceab49ae000e7f66103/src/MyNet.Collections/ImmediateCollectionEventDispatcher.cs
Tag: 323_28699572109
Line coverage
100%
Covered lines: 6
Uncovered lines: 0
Coverable lines: 6
Total lines: 36
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.cctor()100%11100%
.ctor()100%11100%
CheckAccess()100%11100%
Dispatch(...)100%11100%

File(s)

https://raw.githubusercontent.com/sandre58/MyNet/85372080fe102cd9ee155ceab49ae000e7f66103/src/MyNet.Collections/ImmediateCollectionEventDispatcher.cs

#LineLine coverage
 1// -----------------------------------------------------------------------
 2// <copyright file="ImmediateCollectionEventDispatcher.cs" company="Stéphane ANDRE">
 3// Copyright (c) Stéphane ANDRE. All rights reserved.
 4// </copyright>
 5// -----------------------------------------------------------------------
 6
 7using System;
 8
 9namespace MyNet.Collections;
 10
 11/// <summary>
 12/// Dispatches events immediately on the current thread.
 13/// </summary>
 14public sealed class ImmediateCollectionEventDispatcher : ICollectionEventDispatcher
 15{
 16    /// <summary>
 17    /// Gets the singleton instance.
 18    /// </summary>
 319    public static ImmediateCollectionEventDispatcher Default { get; } = new();
 20
 321    private ImmediateCollectionEventDispatcher() { }
 22
 23    /// <summary>
 24    /// Always returns true since this dispatcher executes actions immediately on the current thread, meaning it always 
 25    /// </summary>
 26    /// <returns>True, indicating that the current thread has access to the dispatcher.</returns>
 2127    public bool CheckAccess() => true;
 28
 29    /// <inheritdoc />
 30    public void Dispatch(Action action)
 31    {
 332        ArgumentNullException.ThrowIfNull(action);
 333        action();
 334    }
 35}
 36