Browsing 7239 questions and answers with Jon Skeet
DateTime.TryParseExact works fine for me: using System; using System.Globalization; class Test { static void Main() { string text = "23/0212014"; DateTime result; if (DateTime.TryParseExact(text,... more 4/7/2014 8:19:16 AM
Well this looks like it's probably the problem: delegate = (AsynResponse) context; You're casting the context variable to AsynResponse, and that context variable comes from here: new SQLLiteDbHelper(MainActivity.this, ...) So it... more 4/7/2014 7:22:43 AM
Well I suspect that Font is a property rather than a method, in which case you'd just want: p.Font = font5; pr.Font = fontbold; That would certainly be more idiomatic C#. I haven't used iTextSharp, so I could be wrong, but that would be... more 4/7/2014 6:19:33 AM
No, you can't. At least not without reflection, and you shouldn't be using reflection here. Variables in C# are a compile-time concept. (Even with reflection, it'll only work for fields, not for local variables.) If you want a collection... more 4/7/2014 6:16:17 AM
Regardless of whether you're using the same key, HashMap simply isn't thread safe for any writing: Note that this implementation is not synchronized. If multiple threads access a hash map concurrently, and at least one of the threads... more 4/7/2014 5:58:26 AM
You've got three loops, and your inner loop goes through the whole range of the deck - and assigns a card to it which doesn't depend on the index: for (int i = 0; i < theDeck.length; i++) { theDeck[i] = new Card(s,v); } So for... more 4/7/2014 5:52:46 AM
In the code below, if the string "Mult" comes before the test1(4) method call, why does the method output before the string? Because you're calling the method before you're calling System.out.println with the "Mult:" part. Basically,... more 4/6/2014 9:00:02 PM
It can make a difference at the point of invocation. For example: using System; class Test { delegate void Foo(int x, int y); static void Main() { Foo foo = (x, y) => Console.WriteLine("x={0}, y={1}", x, y); ... more 4/6/2014 8:41:45 PM
You haven't closed the writer. It's almost certainly just buffered all the data. You should always close IO streams etc. If you're using Java 7+, you can use a try-with-resources statement: try (PrintWriter fileout = new... more 4/6/2014 8:10:19 AM
Currently I suspect you're parsing the date as a Gregorian date - which will fail if you try to input a date with a month of 2 but a day of 30 or 31 (or a day of 28 in a non-leap year). DateTime itself assumes the Gregorian calendar, but... more 4/6/2014 8:03:08 AM