Browsing 7239 questions and answers with Jon Skeet
In this particular case, it's okay - the two streams involved (the ObjectOutputStream and ByteArrayOutputStream) don't use any unmanaged resources (file handles, network handles) etc so it's okay for the garbage collector to just take care... more 6/30/2014 2:31:21 PM
That's just a filter on the groups afterwards: var results = from item in assignments where item.IdClient == 19 group item by new { item.IdShiftSchedule, item.Date } into g where g.Count()... more 6/30/2014 12:50:01 PM
Basically it's a matter of degrees of laziness. It's lazy in that it won't construct the singleton until the class is initialized, but it's eager in that there could be situations where you want to use the class without initializing the... more 6/30/2014 9:45:42 AM
I changed the value of String s Yes, you changed the value of s. That's all you changed. The map still contains the previous value of the variable. You haven't changed the meaning of that value. We can simplify your example to just... more 6/30/2014 8:57:20 AM
* has a special meaning in regular expressions - it means "match 0 or more of the preceding character/group". It sounds like you don't want a regex at all - you just want string result = seltext.Replace("/*", "//"); If you really want... more 6/30/2014 6:00:30 AM
No, you don't need Visual Studio on your build box. If I recall correctly, msbuild is installed as part of the .NET framework - it certainly used to be. Depending on what you're building, you may find that there are some things which are... more 6/30/2014 5:54:49 AM
Even if the filenames aren't predictable based on number, you could still have a collection of them. For example: // Common prefix removed for brevity private static final String[] IMAGE_FILES = { "img1.gif", "happy.gif", "sad.gif" /*... more 6/30/2014 5:50:42 AM
Can anybody tell me what I am doing wrong here? Yes - you're not synchronizing on the object you're waiting on. The API documentation is pretty clear: Throws: IllegalMonitorStateException - if the current thread is not the owner... more 6/29/2014 6:53:27 PM
It sounds like you originally just wrote the Product objects to an ObjectOutputStream, rather than a Map<Integer, Product>. If that's the case, you need something like: Map<Integer, Product> products = new... more 6/29/2014 6:46:52 PM
Throw an exception and don't catch it. Let it propagate all the way up. If something you consider to be impossible has happened, then you should have no confidence at all in your ability to "handle" it... the world is hugely screwed... more 6/28/2014 8:25:35 PM