C# Client Library
A C# Client Library for the AnalyzeRe REST API
Loading...
Searching...
No Matches
NumericValidationAttribute.cs
Go to the documentation of this file.
1
using
System;
2
using
AnalyzeRe.Utilities
;
3
4
namespace
AnalyzeRe.Attributes
5
{
7
[AttributeUsage(AttributeTargets.Property, Inherited =
true
, AllowMultiple =
true
)]
8
public
abstract
class
NumericValidationAttribute
:
ValidationAttribute
9
{
15
protected
double
GetValue
(
object
value)
16
{
17
try
18
{
19
if
(value is
MonetaryUnit
)
20
return
((
MonetaryUnit
)value).value;
21
else
22
return
Convert.ToDouble(value);
23
}
24
catch
(InvalidCastException e)
25
{
26
throw
new
InvalidCastException(
"The "
+ GetType().NiceTypeName() +
27
" cannot be used for properties of type "
+ value.GetType().NiceTypeName(), e);
28
}
29
}
30
}
31
}
AnalyzeRe.Attributes.NumericValidationAttribute
Any attribute that can validate the value of a property.
Definition
NumericValidationAttribute.cs:9
AnalyzeRe.Attributes.NumericValidationAttribute.GetValue
double GetValue(object value)
Gets the double value corresponding to the supplied object.
Definition
NumericValidationAttribute.cs:15
AnalyzeRe.Attributes.ValidationAttribute
Any attribute that can validate the value of a property.
Definition
ValidationAttribute.cs:8
AnalyzeRe.MonetaryUnit
Representation of a monetary value with a currency.
Definition
MonetaryUnit.cs:14
AnalyzeRe.Attributes
Definition
APITypeAliasAttribute.cs:4
AnalyzeRe.Utilities
Definition
AsyncRequestMonitor.cs:8
src
AnalyzeRe.Client
Attributes
NumericValidationAttribute.cs
Generated on Fri Dec 8 2023 15:18:43 for C# Client Library by
1.9.8