Browsing 7239 questions and answers with Jon Skeet
To create an inner class (as opposed to a nested static class) you need an instance of the enclosing class - you don't have one in this case. Note that there's no direct equivalent of inner classes in C# - a nested class in C# is more like... more 3/19/2015 6:44:00 AM
You can use Type.IsAssignableFrom: var typeArgument = typeof(int); var baseType = typeof(Base<>).MakeGenericType(typeArgument); var matches = someAssembly.GetTypes() .Where(t =>... more 3/18/2015 10:19:33 PM
Just use the XmlNodeReader constructor: using (XmlReader reader = new XmlNodeReader(content)) { // ... } (The documentation says you should use XmlReader.Create - but there are no overloads taking an XmlNode, so that doesn't seem... more 3/18/2015 9:57:30 PM
Basically you'd need to do the split again in the subclass constructor - the local variable result isn't available in the subclass constructor: public Sub(String d){ super(d); String[] result = d.split(","); setF(result[5]); ... more 3/18/2015 7:47:20 PM
Well, you might think about whether it would make sense to have a type which represents a start/end combination. A sort of... Interval. (Yes, this is a not-so-subtle plug for Noda Time, which makes date/time handling generally better... more 3/18/2015 7:42:45 PM
You can't. int isn't a valid identifier in Java, because it's a keyword. From JLS 3.8: An identifier cannot have the same spelling (Unicode character sequence) as a keyword (§3.9), boolean literal (§3.10.3), or the null literal... more 3/18/2015 7:12:29 PM
You're parsing an empty string, because you never assign a different value to json. You make a request, and set is to refer to the input stream from the response - but you then don't use is. You might want: JObj = new JSONObject(new... more 3/18/2015 7:04:11 PM
You're calling DateTime.Now before you set up the shim... so it can't possibly retroactively change the value of actual. I suspect if you use: Dim actual As DateTime 'Act Using (ShimsContext.Create()) System.Fakes.ShimDateTime.NowGet... more 3/18/2015 4:10:25 PM
Sounds like you just want to await later in the method: public async void SomeMethod() { var cameraTask = DoCameraWork(); TextBox.Text = "Waiting For camera work"; SendData(); var result = await cameraTask; TextBox.Text =... more 3/18/2015 3:25:38 PM
I want to know whether the variables startIndex and stopIndex within the delegate point to the same location as their namesakes outside the delegate. Yes, they do. The variables themselves are captured - changes made within the... more 3/18/2015 2:53:00 PM