Browsing 7239 questions and answers with Jon Skeet
At the end of the fight, I'd like a "WinnerReference" reference to "point" to the last boxer standing It sounds like you're looking for pass-by-reference. That doesn't exist in Java - all values are passed by value, but for any... more 11/21/2014 8:52:27 PM
When you run a web application, the current working directory of the process isn't the directory containing your source code. You might want to look at HttpServerUtility.MapPath or HostingEnvironment.MapPath. Note that this doesn't really... more 11/21/2014 8:39:05 PM
It sounds like you should have an abstract base class for the section which has all the repeated code - it's not entirely clear why you need separate types at all, to be honest. You can then have: private List<LinkData>... more 11/21/2014 6:52:51 PM
How can I add a "constarint" that forces me to decorate a new EOrderStatusType item with the custom attribute EnumParent? There is a way to ask to compiler to notify an exception during compile? Two options: Add a unit test. This... more 11/21/2014 5:38:21 PM
I don't want to add a Clock argument to the method because the real code shouldn't be concerned with passing in a clock. No... but you might want to consider it as a constructor parameter. Basically you're saying that your class needs... more 11/21/2014 5:34:08 PM
Comparable<T> is a generic type, but you're using the raw type, losing type safety. You probably want to make your BinNode generic too, in its element type: public class BinNode<T extends Comparable<T>> { private T... more 11/21/2014 4:39:00 PM
If you're trying to the array reference, just lose the []: Createnewfile(tokens); That's not just passing tokens[1], however. It's very odd that your Createnewfile method always uses tokens[1] - it would make more sense for that... more 11/21/2014 4:32:11 PM
You can make your unit test async as well: [TestMethod] public async Task TestIfListFilled() { // arrange byte stuffTypeID = 0; // act List<Stuff> locationList = await GetStuffListAsync(stuffTypeID ); //... more 11/21/2014 1:22:07 PM
That isn't possible, in a general sense. Consider these two files: Foo.cs: #define X #if Y #error Bang! #endif #if !X #error Bang! #endif class Foo {} Bar.cs: #define Y #if X #error Bang! #endif #if !Y #error Bang! #endif class... more 11/21/2014 1:00:42 PM
Look at the code: public void newFlavour(String flavours) { flavours.add(flavours); } The parameter flavours is shadowing your field flavours, so the compiler is trying to find an add method in String, not ArrayList. You... more 11/21/2014 11:45:21 AM