Browse by Tags

Tagged Content List
  • Blog Post: Working with Signed Non-Decimal and Bitwise Values [Ron Petrusha]

    Recently, a number of questions have surfaced about the accuracy of the .NET Framework when working with the binary representation of numbers. (For example, see https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=295117 .) The issue surfaces most clearly when we convert the...
  • Blog Post: Decimal Negative Zero Representation [Lakshan Fernando]

    One of our customers wondered recently if we represent negative zero in Decimal. At first glance, it doesn’t look to be the case as seen below; Decimal zero = Decimal .Zero; Decimal negativeZero_1 = new Decimal (0, 0, 0, true , 0); Decimal negativeZero_2 = -0.0m; Decimal negativeZero_3 = Decimal ...
  • Blog Post: Arbitrary length Integer/Arbitrary precision Double Classes [Ari Weinstein]

    Another set of functionality we may want to add in Orcas are classes which can be an integer of arbitrary length, and a double of arbitrary precision (which could essentially be the arbitrary length integer with a decimal offset). Aside from this type itself, we are interested in what related functionality...
  • Blog Post: Why does Double.Parse(Double.MaxValue.ToString()) not work? [Anthony Moore]

    System.Double and System.Single are have inexact precision of decimal digits because internally they are a floating point binary number. As such, beyond a certain number of significant digits, their decimal representation becomes approximate. The standard Double.ToString() and Single.ToString() thus...
  • Blog Post: How Did System.Decimal Change from V1.0 to V1.1? [Anthony Moore]

    There were very few noticeable changes between the V1.0 and the V1.1 release. One change that people sometimes notice is that Decimal looks different across the two versions. The changes are largely cosmetic, although in some rare cases applications have been affected. Decimal was revised to comply with...
  • Blog Post: New Format on the Block [Anthony Moore]

    One thing that has not changed much in Whidbey is the set of format strings used by base data types for parsing and formatting. However, there is one new format element supported by the DateTime class that can be very useful if you use the ParseExact method to parse XML. There is a new format element...
  • Blog Post: How to Work Around Problems Serializing DateTime in XML [Anthony Moore]

    I wrote a while ago about problems with the way DateTime worked with features like DataSet, XML Serialization (WebServices) and XmlConvert. Basically, DateTime is always treated as a local time by these XML-based systems, which means that you get incorrect results if you use UTC or whole dates with them...
  • Blog Post: DateTime Parsing and Formatting with Time Zones [Anthony Moore]

    Here is a new DateTim FAQ entry. What is the relationship between DateTime parsing and formatting and the time zone? Before reading below, see this entry for a more practical description of how to using formatting and parsing for the purposes of storing dates and times, which is where you are most likely...
  • Blog Post: A short note about Buffer.BlockCopy [Gang Peng]

    Buffer.BlockCopy has following signature: public static void BlockCopy(Array src, int srcOffset, Array dst, int dstOffset, int count); It copies count bytes from src , beginning at srcOffset , to dst , beginning at dstOffset . srcOffset is the byte offset into src and dstOffset is the byte offset into...
  • Blog Post: Dead C Hacks: Reallocating or Changing an object's type in place in .NET? [Brian Grunkemeyer]

    I was recently asked if there was a way to reallocate an object on top of another one, or to change the type of an object at runtime. This must have been a somewhat common practice in native C or C++ programs, perhaps something that C++'s placement new facilitated. I'm not a big fan of the idea in general...
  • Blog Post: .NET Arrays, IList<T>, Generic Algorithms, and what about STL? [Brian Grunkemeyer]

    When we were designing our generic collections classes, one of the things that bothered me was how to write a generic algorithm that would work on both arrays and collections. To drive generic programming, of course we must make arrays and generic collections as seamless as possible. It felt that there...
  • Blog Post: Array.IndexOf performance caveat[Gang Peng]

    Array.IndexOf are “generic” methods to search for an item in an one dimensional array. However since they are generic, there are some performance caveats. Array.IndexOf handles arrays in three different ways: (1) If the array is a SZArray (one dimensional array with zero-based indexing) and element type...
  • Blog Post: Why Not Add a New DateTime Date Type in Whidbey?

    [Anthony Moore] Thanks very much to those who have posted feedback on this issue: http://weblogs.asp.net/bclteam/archive/2004/05/21/136918.aspx This reply to the feedback got quite lengthy, so I started a new entry on it. >> "You COULD have seen and SHOULD have seen this" We would...
  • Blog Post: Changes to Decimal.ToString between V1.0 and V1.1

    [Anthony Moore] There was a change to Decimal class in V1.1 to preserve trailing zeros in the default foramtting. I thought this was well known, but we just recently got a customer support issue on it. Here is an entry that we will shortly add to the numerics FAQ. Why did Decimal.ToString change...
  • Blog Post: DateTime FAQ Entries

    I have recently created some new DateTime FAQ entries to address some questions people have about using DateTime on blogs. Our web site is in transition, so I'm posting some of these into the blog. However, they will eventually be rolled into the DateTime FAQ on the BCL web site. Why is DateTime not...
  • Blog Post: Kick Off the Blog with a TryParse sample!

    Well, I though I would kick off the BCL blog with a sample of TryParse. TryParse methods have been added to all the base datatypes in Whidbey (previously, TryParse was only available on the Double type). The TryParse demo is available on the new BCL website . The demo allows you to compare the speed...
Page 1 of 1 (16 items)