Browsing 7239 questions and answers with Jon Skeet
If nextInt() fails, it throws an exception but doesn't consume the invalid data. From the documentation: When a scanner throws an InputMismatchException, the scanner will not pass the token that caused the exception, so that it may be... more 2/18/2015 4:04:33 PM
How can I keep the declared order as it is in the class file, no matter what fields I set? You can't, with getDeclaredMethods. The documentation is very clear about this: The elements in the returned array are not sorted and are... more 2/18/2015 2:22:29 PM
Sounds like you just need to take the complete list of neutral (language-only) cultures, join that with your English names list, and then project that: var languageCultures = CultureInfo.GetCultures(CultureTypes.NeutralCultures); var... more 2/18/2015 1:26:46 PM
But if the cast to Wire fails and results in null does not mean part is null too. No, but the reverse is true - if part is null, then wire will definitely be null, so you'll already have returned... hence the warning. (I'm assuming... more 2/18/2015 10:41:49 AM
You can't multiply strings together. You can multiply numbers, and it sounds like that's what you want to do. Indeed, you're already parsing the strings as integers - and then ignoring the result. You just need to change this: ... more 2/18/2015 10:39:04 AM
Where you're raising the event, you can call Delegate.GetInvocationList to get all the subscribers - and then use a separate task or thread per subscriber to call them all in parallel. Note that your subscribers will have to be... more 2/18/2015 10:02:00 AM
Just using new creates a new method without associating it with the interface. You're using the interface in your real code (I assume) so you want the binding of the interface method to the new method. To do that, you have to declare that... more 2/18/2015 9:02:44 AM
If you're happy with UTC days, life becomes simpler: The milliseconds-since-the-unix-epoch starts on a day boundary, so you can just divide Each day is 24 hours long, which is handy in many cases (e.g. if you're doing analytics with the... more 2/18/2015 8:19:55 AM
Enums in Java and .NET are very different. In .NET, they're just named numbers, basically. In Java they're a fixed set of objects - which you can give extra behaviour etc. Also, the C# code isn't "extending" byte - it's just using byte as... more 2/18/2015 7:04:38 AM
You're specifiying the namespace manager - but not the namespace. The FuelGradeMovement element has inherited the "http://www.naxml.org/POSBO/Vocabulary/2003-10-16" namespace URI from its parent, so I believe you want: var iterator =... more 2/17/2015 3:56:06 PM