Browsing 7239 questions and answers with Jon Skeet
There's no such thing as a "static instance" and a "normal instance". There are only static variables (and methods etc). So for example: public class Foo { static Object bar = new Object(); Object baz = bar; } Here the values of... more 12/17/2013 9:55:09 AM
It's not clear what you're trying to do, but just getting the time of day shouldn't involve string conversions: TimeSpan time = _stateTime.TimeOfDay; I'd strongly advise you to avoid string conversions unless they're inherently part of... more 12/17/2013 9:52:26 AM
You're explicitly telling the continuation to run in the current synchronization context by specifying TaskScheduler.FromCurrentSynchronizationContext() So yes, that will block the UI thread because it's running in the UI thread... more 12/17/2013 8:22:43 AM
This is the problem: hexString.append(Integer.toHexString(0xFF & bytes[i])); This will lose any leading 0s - in other words, any byte less than 16 will come out as a single hex digit instead of two. There are plenty of fixes for... more 12/17/2013 8:18:23 AM
It sounds like you want a lookup: var stopTimesByTripId = StopTimes.ToLookup(st => st.TripId); Or to narrow it down by ListOfTripId first: var tripIdSet = new HashSet<string>(ListOfTripId); var stopTimesByTripId =... more 12/17/2013 8:11:53 AM
If you're using .NET 4, you can just use Zip: var server = new XElement("server", new XAttribute("serverid", ServerId), new XAttribute("name", ServerName), PortName1.Zip(PortId1, (name, id) => ... more 12/17/2013 7:03:45 AM
The simplest approach is probably to print the previous line each time: String previousLine = null; String line; while ((line = reader.readLine()) != null) { if (previousLine != null) { System.out.println(previousLine); } ... more 12/16/2013 5:14:39 PM
Unless anything uses the sender parameter, it won't matter. Logically it would make sense to use the type: handler(typeof(TypeDeclaringEvent), new PropertyChangedEventArgs(PropertyName)); EDIT: Note that in the document you referred to,... more 12/16/2013 1:28:12 PM
How can I restrict the GetMemberName method so that it can accept only members of the classes which derive from my base class? It's not clear what you mean by "accept" here, but if you're trying to restrict the set of valid lambda... more 12/16/2013 8:52:50 AM
The trouble is that you're trying to deserialize an object when you've already read all the data from it just beforehand: readStream = new StreamReader(receiveStream); Console.WriteLine (readStream.ReadToEnd()); After those line, the... more 12/16/2013 6:48:15 AM