Browsing 7239 questions and answers with Jon Skeet
I suspect you're looking for Descriptor.findFieldByNumber. Note that will find a field by number, not an extension. For extensions, use ExtensionRegistry.findExtensionByNumber. more 11/8/2013 10:42:08 PM
Two options: Create a ZonesFactory class, which takes a defaultMinScore in the constructor (to remember) and has a CreateZones method which creates an instance and sets the min score: public class ZonesFactory { private readonly int... more 11/8/2013 9:16:58 PM
No, when you return you'll be returning a reference to the array you've just created. The reference will be copied, but that's dirt cheap. All arrays are reference types, even if the element type of the array is a value type (so int[] is... more 11/8/2013 8:34:07 PM
Your If condition is basically saying if it hasn't successfully parsed it as a number. You want something like: If Decimal.TryParse(txtParts.Text, decParts) Then If decParts <= 0 Then MessageBox.Show("ERROR: Value must be a... more 11/8/2013 8:31:15 PM
How would you expect the compiler to work out which one you meant? Yes, if you're trying to create different methods with the same parameters, you need to give them different names. I would suggest ToBrowseDto and ToEditDto. Then it's... more 11/8/2013 8:18:22 PM
Your code won't even compile cleanly at the moment, as the x++; statement is unreachable. Always pay attention to warnings. However, after fixing that, it works fine: using System; using System.Threading.Tasks; class Test { static... more 11/8/2013 6:02:22 PM
I suspect the value of userdeleted is just lecturer rather than 'lecturer'. Therefore your SQL statement is: DELETE FROM COMMENT WHERE USERNAME=lecturer That's the immediate problem - it's looking for a column called lecturer. If you... more 11/8/2013 5:40:16 PM
Isn't the result supposed to be true? No. You're calling equals on two different array references. Arrays don't override equals, therefore you get reference equality. The references aren't equal, therefore it returns false... To... more 11/8/2013 5:36:09 PM
The project is set on Target Framework to: .net 4 client profile. That's the problem. HttpUtility doesn't exist in the client profile. Target the full profile instead (and make sure you have a reference to System.Web.dll). Compare... more 11/8/2013 4:53:08 PM
You're specifying a time zone of GMT-8:00 - that's a fixed time zone, which is 8 hours behind of UTC permanently. It doesn't observe daylight saving time. If you actually meant Pacific Time, you should specify America/Los_Angeles as the... more 11/8/2013 4:36:32 PM