Browsing 7239 questions and answers with Jon Skeet
I thought that passing a reference type, such as a List< to a method allowed the method to modify the type, and have those changes seen outside the method You're getting confused with passing a parameter by reference (using the ref... more 3/30/2014 3:33:12 PM
This is the problem: return Encoding.ASCII.GetBytes(dt.Rows[0][0].ToString()); You're converting the value to a string. It's not text data - just don't do it! I would expect you to be able to just cast the value to byte[]: return... more 3/30/2014 3:14:56 PM
I would like to change the ElementName of Item dynamically Attributes in .NET really aren't designed for that. The idea is that they're compile-time metadata. If you want more dynamic metadata, you'll need to take a different... more 3/30/2014 2:58:13 PM
Your attribute is being applied to the properties. While you do have fields, they're created by the compiler - and your custom attribute isn't being applied to them. Your code is broadly equivalent to: [CompilerGenerated] private... more 3/30/2014 1:40:53 PM
For example, when I work on excel, sometimes I like to save different versions of excel workbooks so that I can roll back if there is a problem. Learn to use a good source control (version control) system. That's a much cleaner... more 3/30/2014 1:35:46 PM
I would structure the code very differently: Create a class for both the type and description Don't use all those if statements - you're doing basically the same thing in every situation. You can always use a HashSet<string> for... more 3/30/2014 12:21:21 PM
Currently, you have this statement: power2(n, x, count); ... which ignores the result completely. In that branch, we never return anything from the method call. I suspect these two issues are linked. I suspect you just want: return... more 3/29/2014 7:45:41 PM
The simplest way is to use Type.IsAssignableFrom: if (typeof(BaseEntity).IsAssignableFrom(type)) more 3/29/2014 7:22:11 PM
My understanding is char means it specifies the unicode value, I want to know the unicode values of char like ,(comma) etc Well there's an implicit conversion from char to int, which you can easily print out: int value =... more 3/29/2014 6:53:59 PM
You wouldn't do it quite like that - that's currently redirecting to a file. You either want to pipe it to java, or redirect in the other way: java Foo < myTextFile or cat myTextFile | java Foo Next, you should use System.in, as... more 3/29/2014 4:27:55 PM