In SQL Server we can write data AS Numeric(15,10) .. what will the equivalent of this in C#?
I know that Numeric‘s equivalent is Decimal but how to represent Numeric(15,10)?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There isn’t a direct equivalent, in that there are no built-in .NET types which allow you to specify the precision/scale explicitly as far as I’m aware. There’s no fixed-point type like NUMERIC.
decimalanddoubleare the common floating point types in .NET, withdecimalimplementing decimal floating point (like NUMERIC in T-SQL) anddoubleimplementing binary floating point behaviour (like FLOAT and REAL in T-SQL). (There’sfloatas well, which is a smaller binary floating point type.)You should choose between
decimalanddoublebased on what values you’re going to represent – I typically think of “man-made”, artificial values (particularly money) as being appropriate fordecimal, and continuous, natural values (such as physical dimensions) as being appropriate fordouble.