Browsing 7239 questions and answers with Jon Skeet
Unfortunately, there is no method of the .NET Framework which can do this. True, but there is Noda Time instead :) (It's my port of Joda Time to .NET, although there are quite a few differences between the two projects.) LocalDate... more 12/19/2013 10:01:51 AM
I suspect this is the problem: foreach(System.Type cls in classes) { methods = cls.GetType().GetMethods(...) cls is already a Type, so calling GetType() on it will return System.Type (or a subclass). I suspect you just... more 12/19/2013 8:13:17 AM
The simplest option is probably to use my Noda Time library, which was designed for exactly this sort of thing (as well as making it cleaner to work with dates and times in general): LocalDate start = new LocalDate(2013, 1, 5); LocalDate... more 12/19/2013 6:50:33 AM
EDIT: Subsequent to your comment: actually I am trying to capture whole page as a picture of a random website to convert as PDF Then you're going about it the wrong way. You'll need to start a browser (e.g. a... more 12/18/2013 5:53:37 PM
Does this mean that the string in x is now encoded into UTF-8? No. It means that when the writer receives a string (which is always effectively in UTF-16) it is encoded into bytes using the specified encoding, and then written to the... more 12/18/2013 3:13:33 PM
As I understand it this is just saying that a is expected to be in ISO-8859-1. Well, it's expecting the data in the stream that a refers to to be textual data encoded in ISO-8859-1. It is not doing any kind of conversion? Yes it... more 12/18/2013 2:45:50 PM
This is the problem: ((long)( 48 * 24 * 3600 * 1000)) That's doing all the arithmetic in 32 bits, and then converting the (now truncated, as the result is too large for an int) result to a long. You want: 48L * 24 * 3600 * 1000 where... more 12/18/2013 1:35:52 PM
I suspect you'll need to remove the existing text node(s), and then create three new nodes: The text before <element2> <element2> The text after <element2> Add all of those to <element1> after removing the... more 12/18/2013 10:55:41 AM
I think this is a subtlety of the unbox and unbox.any IL instructions. From ECMA 335, section III.4.32 (unbox operation - unbox.any is similar) Exceptions: System.InvalidCastException is thrown if obj is not a boxed value type,... more 12/18/2013 10:49:47 AM
I regard "method" as a sort of implementation detail here - whereas the mathematical concept of a function is common. (How often have you heard of delegates being described as "function pointers"?) Note that the word "function" appears... more 12/18/2013 10:01:27 AM