Browsing 7239 questions and answers with Jon Skeet
First, the basics: when declaring a method, you need to specify the type of the parameter, which in this case would be long: public ActionResult Abc(long id) { // ... } When you call that (whether internally or whether it's... more 3/5/2017 12:35:34 PM
The type of your delegare variable is just Delegate. That could refer to any delegate. In order to invoke a delegate (in the normal way), you should have an expression of the appropriate type. After fixing the naming conventions and... more 3/4/2017 4:11:52 PM
No, it's not. System.Decimal maintains trailing zeroes (since .NET 1.1) but not leading zeroes. So this works: decimal d1 = 1.00m; Console.WriteLine(d1); // 1.00 decimal d2 = 1.000m; Console.WriteLine(d2); // 1.000 ... but your leading... more 3/3/2017 7:26:30 AM
LINQ is the simplest way of doing this, with the Except method: var inOnlyVariableList = variableList.Except(method).ToList(); The result will be a List<string> of strings which are in variableList but not in method. more 3/2/2017 11:51:41 AM
Import just means "make the imported classes available by their simple names" - you can remove imports entirely if you use fully-qualified names everywhere. It's definitely not like #include in C for example. When you compile, if you try... more 3/2/2017 7:47:12 AM
PropertyInfo "knows" which type you used to ask for it. For example: using System; using System.Reflection; class Base { public int Foo { get; set; } } class Child : Base { } class Test { static void Main() { ... more 3/1/2017 3:00:40 PM
You mean you want only the first child node? Yes, that's simple using the Remove extension method: doc.Root.Elements().Skip(1).Remove(); Sample: using System; using System.Linq; using System.Xml.Linq; class Test { static void... more 3/1/2017 9:35:52 AM
As ever, you should test performance rather than guessing about it or asking others to guess. However, two things to think about: You've shown an IPv4 address... what about IPv6? That could definitely complicate things The IPv4 address... more 2/28/2017 3:58:48 PM
Things are scary when you access shared data with no synchronization etc: There's no guarantee that the Alpha thread reading i will see the "latest" update from the beta thread or vice versa It's possible for both threads to start i++ at... more 2/28/2017 2:41:09 PM
Each time you call GetMenu, you're creating a new StringWriter - but you're ignoring the return value from your recursive calls. The simplest fix would probably be to change it to: public string GetMenu(Node currentPage) { var... more 2/28/2017 1:22:30 PM