/
ConstructorInfo.cs
48 lines (38 loc) · 1.8 KB
/
ConstructorInfo.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Diagnostics;
using System.Globalization;
using System.Runtime.CompilerServices;
namespace System.Reflection
{
public abstract partial class ConstructorInfo : MethodBase
{
protected ConstructorInfo() { }
public override MemberTypes MemberType => MemberTypes.Constructor;
[DebuggerHidden]
[DebuggerStepThrough]
public object Invoke(object?[]? parameters) => Invoke(BindingFlags.Default, binder: null, parameters: parameters, culture: null);
public abstract object Invoke(BindingFlags invokeAttr, Binder? binder, object?[]? parameters, CultureInfo? culture);
public override bool Equals(object? obj) => base.Equals(obj);
public override int GetHashCode() => base.GetHashCode();
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator ==(ConstructorInfo? left, ConstructorInfo? right)
{
// Test "right" first to allow branch elimination when inlined for null checks (== null)
// so it can become a simple test
if (right is null)
{
return left is null;
}
// Try fast reference equality and opposite null check prior to calling the slower virtual Equals
if (ReferenceEquals(left, right))
{
return true;
}
return (left is null) ? false : left.Equals(right);
}
public static bool operator !=(ConstructorInfo? left, ConstructorInfo? right) => !(left == right);
public static readonly string ConstructorName = ".ctor";
public static readonly string TypeConstructorName = ".cctor";
}
}