Skip to content

Commit 694e965

Browse files
committed
Add annotations
1 parent ea68a0f commit 694e965

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Main/src/Reflection/ReflectionExtensions.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,10 +487,10 @@ public static bool IsAnonymous([NotNull] this Type type)
487487
/// Otherwise returns null.</param>
488488
/// <returns>Returns <see cref="ConstructorInfo"/> or null.</returns>
489489
[Pure]
490+
[ContractAnnotation("exceptionIfNotExists:true => notnull; exceptionIfNotExists:false => canbenull")]
490491
public static ConstructorInfo GetDefaultConstructor([NotNull] this Type type, bool exceptionIfNotExists = false)
491492
{
492-
if (type == null)
493-
throw new ArgumentNullException(nameof(type));
493+
Code.NotNull(type, nameof(type));
494494

495495
var info = type.GetConstructor(
496496
BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public,
@@ -512,6 +512,8 @@ public static ConstructorInfo GetDefaultConstructor([NotNull] this Type type, bo
512512
/// </summary>
513513
/// <param name="type">Type to get item type.</param>
514514
/// <returns>Returns item type or null.</returns>
515+
[CanBeNull]
516+
[Pure]
515517
public static Type GetItemType([CanBeNull] this Type type)
516518
{
517519
while (true)

0 commit comments

Comments
 (0)