atlaste
atlaste

Reputation: 31106

C# correct alternative for SQL Numeric

I've been playing around with Numerics and the c# 128-bit counterpart decimal and noticed some differences. For one, C# decimal is 128-bit, while SQL numeric occupies an extra byte.

What I was wondering is: what would be the 'correct' (fast) SQL compliant way to implement a Numeric/Decimal in C# (just as an 'academic question')?

Oh and to make the question a bit harder:

Because a numeric with 17 bytes is the hardest, this is the one that really interests me. The other precisions are just variations on it that probably require another struct.

Upvotes: 0

Views: 483

Answers (1)

Remus Rusanu
Remus Rusanu

Reputation: 294227

System.Data.SqlTypes.SqlDecimal already offers this. It offers the arithmetic as well.

Upvotes: 2

Related Questions