Browsing 7239 questions and answers with Jon Skeet
Just test it by passing it a namespace which contains a class called Main which isn't derived from Window. Now you may find that tricky because if Type.GetType(string) is passed a value which is a non-assembly-qualified name, it will only... more 1/14/2016 8:37:14 AM
You're calling ToArray() before you've closed the GZipStream... that means it hasn't had a chance to flush the final bits of its buffer. This is a common issue for compression an encryption streams, where closing the stream needs to write... more 1/13/2016 7:50:08 PM
You're calling ToString() on an array. That doesn't do what you expect it to. It's not clear exactly what you do expect it to do, but it's almost certainly not what you want. You quite possibly want to call string.Join,... more 1/13/2016 3:56:29 PM
You can use: var maybeValueType = obj as MyValueType?; if (maybeValueType != null) { // Use maybeValueType.Value } However, this performs worse than is + casting - or at least has in the past. It's possible that C# 7 will fix this... more 1/13/2016 11:27:03 AM
A conversion isn't a division - those are two separate operations. You appear to be trying to combine them at the moment. Fundamentally, it seems that you should remove this operator: // Kill this public static Length operator /(Length... more 1/13/2016 10:11:13 AM
You may be having trouble due to how you've passed in the IDs. You may find that converting that sequence into a list or an array would help: // Various names to be more conventional/readable public List<Items>... more 1/13/2016 8:25:33 AM
A "property with a parameter" in C# is an indexer. You can't give it a name like you can in VB though1. You declare it like this: public int this[bool parameter] { get { ... } set { ...} } Now that may or may not be appropriate... more 1/13/2016 7:20:31 AM
Unless GetPreviousCacheEntry could have problematic side-effects, it seems to me that you don't need method A at all. Just call method B and ignore the return value if you're not interested in it. As noted in comments, the methods aren't... more 1/12/2016 5:15:34 PM
its automatically converting to my local time zone i.e. IST No it's not. A Date object doesn't have a time zone - it's just an instant in time. You'll see the system-local time zone if you call toString() on a Date, because that's... more 1/12/2016 4:17:51 PM
I have studied similar examples and override these methods like this, but still get added to the HashSet<NamedObject> objects with the equal names BUT different id. Yes, because you're only using the id in the hash code, and... more 1/12/2016 7:05:12 AM