-
Notifications
You must be signed in to change notification settings - Fork 76
Open
Labels
needs-triageIndicates that an issue needs to be categorized.Indicates that an issue needs to be categorized.
Description
Hello everybody,
I was writing a Custom condition (ICondition<IType>), which validates the existence of a constructor with exactly one parameter having an expected type.
Code used for the evaluation:
private bool TypeHasMatchingConstructor(IType type)
{
foreach (var constructor in type.GetConstructors())
{
if (constructor.Parameters.Count() == 1 && constructor.Parameters.Single().FullName.Equals(_parameterType.FullName, StringComparison.Ordinal))
{
return true;
}
}
return false;
}Expectation:
The constructor.Parameters returns an IEnumerable<IType> containing the types of all parameters.
However, analyzing types with multiple parameter having the same type, results in only returning one entry in the property Parameters.
// Analyzing the following type returns one entry in the Parameters Enumerable [IType: UInt32]
internal sealed record SignatureOne(uint Signature);
// Analyzing the following type returns two entries in the Parameters Enumerable [IType: UInt32, IType: String]
internal sealed record SignatureCustom(uint Signature, string SignatureString);
// ERROR: Analyzing the following type returns only one entry in the Parameters Enumerable [IType: UInt32]
internal sealed record SignatureTwo(uint Signature, uint SignatureTwo);Let me know if you have any questions!
Cheerz
Metadata
Metadata
Assignees
Labels
needs-triageIndicates that an issue needs to be categorized.Indicates that an issue needs to be categorized.