Browsing 7239 questions and answers with Jon Skeet
It sounds like you're performing string concatenation in a loop. That's a very inefficient way of building a new string. I suspect you want: var builder = new StringBuilder(); foreach (byte c in Bytes) { ... more 10/23/2015 2:49:28 PM
What i want to know is that why Action action = () => DoSomething(); is not a compile time error? It compiles because you've got a lambda expression that calls the method but ignores the result. You couldn't use a method group... more 10/22/2015 2:44:25 PM
The main problem would be in the calling code... but you can avoid calling the method more than once in total, by changing your method to create and return a HashSet<string>: public static class DataRecordExtensions { public... more 10/21/2015 5:54:50 AM
The problem is that you're using an expression tree - which is used by IQueryable<T> (or rather, the extension methods in Queryable targeting IQueryable<T>). For Enumerable.Select, you want a delegate instead. Just change your... more 10/20/2015 7:58:22 PM
I would just try not to do this. The rules you've suggested violate the requirements of Object.equals, in particular: It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns... more 10/20/2015 4:42:20 PM
You have at least three problems here. Firstly, if your fileArray is a List<Word>, you're trying to find a string (the return type of nextLine()) within a list of Word objects... that's never going to work. Secondly, you're trying... more 10/20/2015 6:08:43 AM
AT TIME ZONE takes a time zone name - you're passing in the time zone abbreviation. The names are in the TZNAME column of the results you're showing us, but you're using the value from TZABBREV. Abbreviations are a bad idea... more 10/18/2015 12:15:59 PM
You can't use instanceof with an expression of a primitive type, as you're doing here with availSupply. An int can't be anything else, after all. If getAvailForAssembly() is already declared to return int, then you don't need your if... more 10/17/2015 9:56:12 AM
Look at your constructor: public Superhero(String name) { this.strength = 10; System.out.println("The Superheroes available are :" + name); } That sets the instance field strength, but doesn't do anything with the name instance... more 10/16/2015 4:51:18 PM
You're calling getBytes in Java without passing any charset, so it's using the default one. You want something like: byte[] bytes = "asd".getBytes(StandardCharsets.UTF_16LE); more 10/16/2015 4:47:45 PM