Browsing 7239 questions and answers with Jon Skeet
The problem is that you're using bitwise | to combine characters - that's not providing multiple cases as I think you expect it to. Instead, it's just taking the Unicode values for the different characters and combining them with a... more 3/27/2014 11:58:51 AM
Every constructor (other than in Object) must chain to another constructor as the very first thing it does. That's either using this(...) or super(...). If you don't specify anything, the constructor implicitly adds super() to chain to a... more 3/27/2014 11:03:53 AM
I suspect you want something like: // TODO: Give your variables more meaningful names throughout... int id = int.Parse(up_invno_txtbox.Text); if (invv.Any(item => item.Id == id)) { ... } else { ... } Obviously adjust the use... more 3/27/2014 10:41:34 AM
Well, I now understand why it's happening (I believe, anyway). I've reproduced it in a shorter form which doesn't use lambda expressions, and then I'll explain why the lambdas are important. using System; using... more 3/27/2014 8:38:45 AM
50 is "bigger" than 400 when you treat them as strings, so I suspect that's what you're doing. First: never, never, never build SQL like this. It's susceptible to SQL injection attacks, it leads to error-prone conversions, and it makes... more 3/27/2014 7:01:40 AM
.But String s1 should be abc123 but it output is abc. Strings are immutable in Java. concat doesn't change the existing string - it returns a new string. So if you use: String result = s1.concat("abc"); then that will be "123abc" -... more 3/27/2014 6:50:01 AM
Each time you iterate over the result, you're going to call that Where filter... which removes the items from hashset as it goes. So after it's iterated once, hashset will no longer have any of those items, so there'll be nothing left to... more 3/26/2014 6:34:04 PM
One simple approach would be something like: public static String removeLetters(String source, String lettersToRemove) { StringBuilder builder = new StringBuilder(); for (int i = 0; i < source.length(); i++) { ... more 3/26/2014 5:38:13 PM
There are various things I would change about this code - returning a stack trace as if it's valid data obtained with no problems is a really bad idea, for example, and you should use a StringBuilder instead of repeated string... more 3/26/2014 4:50:35 PM
Using Double.NaN won't help you because NaN is not equal even to itself. It's not clear why you're doing this in two stages though - I'd suggest just: row["Price"] = range.Cells[i, j].Value2 ?? (object) DBNull.Value; more 3/26/2014 4:31:56 PM