473,461 Members | 1,857 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

typeof(decimal).IsPrimitive == False Bug or Feature?


Hi all,

I find it quite surprising that the System.Decimal Type
is not a primitive data type.

Is this on purpose?
Why?

Kind regards,
Carl
--
Carl Rosenberger
db4o - database for objects - http://www.db4o.com
Nov 15 '05 #1
2 6975
Carl Rosenberger <ca**@db4o.com> wrote:
I find it quite surprising that the System.Decimal Type
is not a primitive data type.

Is this on purpose?
Absolutely.
Why?


Because it's not a primitive type. From Type.IsPrimitive:

"The primitive types are Boolean, Byte, SByte, Int16, UInt16, Int32,
UInt32, Int64, UInt64, Char, Double, and Single."

The CLR doesn't need to have any intrinsic knowledge about the decimal
type - it treats it just as another value type which happens to have
overloaded operators. There are no IL instructions to operate directly
on decimals, for instance.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #2
Carl,

I would think that it is because it can be reduced into other, smaller
parts. From the description, the Decimal structure really is made up of
other primitive types, so I can see why IsPrimitive would return false.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Carl Rosenberger" <ca**@db4o.com> wrote in message
news:bq*************@news.t-online.com...

Hi all,

I find it quite surprising that the System.Decimal Type
is not a primitive data type.

Is this on purpose?
Why?

Kind regards,
Carl
--
Carl Rosenberger
db4o - database for objects - http://www.db4o.com

Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: F. Da Costa | last post by:
Hi all, Following two sniperts of code I'm using and getting very interesting results from. ..html <tr id="1" class="segment" open="false"> This is the segment under 'investigation' ..js
4
by: pn | last post by:
Hi when comparing a Type object to several built-in types, do you recommend to use Type.GetTypeCode() instead of typeof() ? Is there a BIG performance difference Example if (type ==...
2
by: | last post by:
Hello, I have a GridView in my ASP.NET 2.0 application that performs the paging feature perfect when I have it bound to a data source. But now I have it bound to a dataset and the paging...
5
by: Jean Pierre Daviau | last post by:
I have disable my firewall, virus software, google pop up allowed, ie6 popp up checker disabled. Is there an other one? This script tels me : "Pop-up windows are blocked. Please disable your...
9
by: Klaus Johannes Rusch | last post by:
IE7 returns "unknown" instead of "undefined" when querying the type of an unknown property of an object, for example document.write(typeof window.missingproperty); Has "unknown" been defined...
4
by: EManning | last post by:
Using A2003. I've got an option group that has a number of check boxes. I have coding to clear the option group if the user wishes to cancel their choice. This coding also clears the rest of the...
20
by: effendi | last post by:
I am testting the following code in firefox function fDHTMLPopulateFields(displayValuesArray, displayOrderArray) { var i, currentElement, displayFieldID, currentChild, nDisplayValues =...
6
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I convert a Number into a String with exactly 2 decimal places?...
3
by: =?Utf-8?B?UGFvbG8=?= | last post by:
I have a table column of SQL smallmoney type which I am updating via a form input field defined as decimal. If I enter, say, 51.09 via the decimal input field (representing $51.09), this is...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.