< Summary

Information
Class: SwiftCollections.MemberNotNullAttribute
Assembly: SwiftCollections
File(s): /home/runner/work/SwiftCollections/SwiftCollections/src/SwiftCollections/Collection/MemberNotNullAttribute.cs
Line coverage
100%
Covered lines: 2
Uncovered lines: 0
Coverable lines: 2
Total lines: 35
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
.ctor(...)100%11100%
.ctor(...)100%11100%

File(s)

/home/runner/work/SwiftCollections/SwiftCollections/src/SwiftCollections/Collection/MemberNotNullAttribute.cs

#LineLine coverage
 1//=======================================================================
 2// MemberNotNullAttribute.cs
 3//=======================================================================
 4// MIT License, Copyright (c) 2024-present David Oravsky (mrdav30)
 5// See LICENSE file in the project root for full license information.
 6//=======================================================================
 7
 8using System;
 9
 10namespace SwiftCollections;
 11
 12/// <summary>Specifies that the method or property will ensure that the listed field and property members have not-null 
 13[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
 14#if SYSTEM_PRIVATE_CORELIB
 15    public
 16#else
 17internal
 18#endif
 19    sealed class MemberNotNullAttribute : Attribute
 20{
 21    /// <summary>Initializes the attribute with a field or property member.</summary>
 22    /// <param name="member">
 23    /// The field or property member that is promised to be not-null.
 24    /// </param>
 225    public MemberNotNullAttribute(string member) => Members = new[] { member };
 26
 27    /// <summary>Initializes the attribute with the list of field and property members.</summary>
 28    /// <param name="members">
 29    /// The list of field and property members that are promised to be not-null.
 30    /// </param>
 231    public MemberNotNullAttribute(params string[] members) => Members = members;
 32
 33    /// <summary>Gets field or property member names.</summary>
 34    public string[] Members { get; }
 35}