This question is locked. New answers and comments are not allowed.
Hello,
JustCode display bad warning that cast is not required if I try to cast object type to dynamic.
Example:
PS.
I tried to post bug report by Public Issue Tracker but it redirect me to this page:
http://www.telerik.com/account/support-tickets.aspx
Regards,
Michał Zalewski
JustCode display bad warning that cast is not required if I try to cast object type to dynamic.
Example:
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple =
false
)]
public
class
PositiveRequiredAttribute : RequiredAttribute
{
protected
override
ValidationResult IsValid(
object
value, ValidationContext validationContext)
{
ValidationResult result = ValidationResult.Success;
try
{
if
((dynamic)value <= 0)
// here JustCode display warning
{
result =
new
ValidationResult(
this
.FormatErrorMessage(validationContext.DisplayName),
new
string
[] { validationContext.MemberName });
}
}
catch
{
result =
new
ValidationResult(
this
.FormatErrorMessage(validationContext.DisplayName),
new
string
[] { validationContext.MemberName });
}
return
result;
}
}
PS.
I tried to post bug report by Public Issue Tracker but it redirect me to this page:
http://www.telerik.com/account/support-tickets.aspx
Regards,
Michał Zalewski