Browsing 7239 questions and answers with Jon Skeet
You seem to be under the impression that a class owns a lock (aka monitor). That's not the case - a thread owns a monitor. Monitors in .NET are re-entrant - if a thread already has the monitor, it can acquire it again. That will increase... more 6/18/2014 12:40:10 PM
Well you can use Union: var union = (from d in dtDummy...).Union (from d in dtDummy...); Personally I'd separate the two out for clarity though: var query1 = ...; var query2 = ...; var union = query1.Union(query2); I'd... more 6/18/2014 12:04:27 PM
What am I doing wrong? You're giving Monday a value of 0, which means it's irrelevant when you perform a bitwise-OR. The only sensible semantic value of 0 in a Flags-based enum is None. You should have: <Flags> _ Public Enum... more 6/18/2014 10:26:06 AM
Both of your sample code snippets will fail because they're looking for elements in no namespace. Your second sample will also fail because you're looking for a license element under the root element, when in fact it is the root... more 6/18/2014 10:18:40 AM
Instead of using .Value, use the explicit conversions in XElement. So for example: FieldName = (string) _field.Element("FieldName"), StartIndex = (short?) _field.Element("StartIndex") You'll end up with null values for absent elements,... more 6/18/2014 8:55:20 AM
You could just use LINQ with a join, which would be more efficient than the nested approach: var query = from dtRow in sqlRows join dtRowId in dttRows1 on Convert.ToInt32(dtRow[1]) equals... more 6/18/2014 6:17:35 AM
It sounds like you want to provide a data URI, basically. For that you'll want something like: src="data:img/png;base64,xxx" where "xxx" is the data in base64 format. So for example, using this public domain base64 library: out... more 6/18/2014 6:04:32 AM
The simplest approach is to have a composite collection which contains a HashSet and an ArrayList. Your add operation would try to add it to the set, and only add it to the list if that has actually added a new item. The get operation... more 6/18/2014 5:55:37 AM
Your basic code for encrypting and decrypting each byte - the call to ModPow - is working, but you're going about the "splitting the message up and encrypting each piece" inappropriately. To show that the ModPow part - i.e. the maths - is... more 6/17/2014 4:52:27 PM
You're closing the FileInputStream before you execute the statement, so there's no way for the statement to get the data when it actually needs it. It would better to pass an InputStream into your method, so you can close it externally... more 6/17/2014 4:27:59 PM