Browsing 7239 questions and answers with Jon Skeet
It sounds like you just want: var items = dataTable.Select(p => string.Format("{0} : {1}", p.NAME, p.TOTALS)); listBox1.Items.AddRange(items.ToArray()); more 9/20/2013 8:24:11 PM
You're asking for properties - but your type only has fields. Either make them properties, like this: public string name { get; set; } ... or use Type.GetField instead. In terms of making it prettier, I'd personally add a static... more 9/20/2013 3:27:12 PM
"16:23:01" doesn't match the pattern of "hh:mm:ss tt" - it doesn't have an am/pm designator, and 16 clearly isn't in a 12-hour clock. You're specifying that format in the parsing part, so you need to match the format of the existing data.... more 9/20/2013 2:42:36 PM
You could make the interface internal, and use InternalsVisibleToAttribute to allow B access to the internal members of A (by adding the attribute to A). It's very coarse-grained though - you can't do it for individual members; it's all or... more 9/20/2013 1:47:58 PM
Fundamentally singletons are hard to test, precisely because of this sort of thing. You could add a clearStateForTesting method: static void clearStateForTesting() { instance = null; } ... but I'd suggest that you avoid the... more 9/20/2013 1:21:20 PM
This is the problem: object obj=new object(); obj=sender as Sender; The second line doesn't change the compile-time type of obj. It's still just object. (And your first line that creates a new object is completely pointless.) The... more 9/20/2013 1:07:49 PM
As far as I can tell, this is the problem (in Server): new Thread(new ServerHandler(klientSocket)).start(); Here you're creating a new ServerHandler. That's completely separate from the instance of ServerHandler which you're creating in... more 9/20/2013 12:40:25 PM
No, you can't cast a value which is actually a reference to an instance of Object[] to an Integer[] variable - and that's a good thing. Imagine if that were valid... consider: Object[] values = { new Integer(5), new Integer(10)... more 9/20/2013 12:18:49 PM
If you're going to query elements that have namespaces using XPath or LINQ to XML, you have to specify that namespace. For example: XNamespace ns = "testNS"; var root = XElement.Parse(xmlString); return root.Descendants(ns +... more 9/20/2013 12:14:21 PM
Get the appropriate TimeZoneInfo for Texas, then use IsDaylightSavingTime. using System; class Test { static void Main() { // Don't be fooled by the "standard" part - this is Central Time var zone =... more 9/20/2013 12:00:17 PM