Browsing 7239 questions and answers with Jon Skeet
Yes, you're getting a list of groups. When you iterate over that, each element of the iteration will be a group - which you can also iterate over. For example: foreach (var group in currentSuppliers) { Console.WriteLine("Group key:... more 1/22/2014 1:06:23 PM
You're calling toString() on a char[]. That doesn't do what you think it does - it will return something like "[C@6af3a631" because arrays don't override toString(). You end up with the default implementation of toString() from Object: ... more 1/22/2014 11:11:01 AM
You've got two different Act classes - one in the Ent namespace, and one in ERP.Actions.Act. Your action variable is of type ERP.Actions.Act, but ctrl.GetAct is returning an Ent.Act reference. It's not clear what these classes are meant... more 1/22/2014 11:07:56 AM
In my method "ThreadFunc", how to know which thread (thread name) is running my method? Get at the current thread with Thread.CurrentThread, and then just use the Name property: string currentThreadName = Thread.CurrentThread.Name; more 1/22/2014 11:00:05 AM
It sounds like you want the reverse of the null-coalescing operator, and there's nothing in either LINQ or the C# language to do that for you. You could create your own extension method to do that if you wanted though: public T?... more 1/22/2014 10:32:14 AM
In each case, the second operand of == is x, which is of type object. That means you're using the normal reference equality operator. Now in your first case, you're using two string constants with the same contents. The C# compiler will... more 1/22/2014 9:01:59 AM
You're not specifying an IV (initialization vector). The encryption and decryption need to use the same IV. For example, one bad way of doing it would be: tdes.IV = new byte[tdes.BlockSize / 8]; ... in both encryption and decryption.... more 1/22/2014 8:35:29 AM
I want the same thing but with the full type name of B. Is it possible? No. A call to B.DoWork is actually compiled into IL for a call to A.DoWork directly. There is no indication in the IL that you actually called B.DoWork, so you... more 1/22/2014 8:10:22 AM
There are at least two problems, probably three. First, your copying code is broken: byte[] buffer = new byte[s.Length]; s.Read(buffer, 0, Convert.ToInt32(s.Length)); You've assumed that this will read all of the data in a single Read... more 1/22/2014 7:11:40 AM
Separate the "business logic" of the class itself from any GUI of it. The GUI should just be a view (possibly with interaction) on top of the business logic. As an example, I recently gave a presentation on "Skeetris" - a block-dropping... more 1/21/2014 8:59:55 PM