Browsing 7239 questions and answers with Jon Skeet
My guess: partial classes. public partial class Foo { static Foo() {} } public partial class Foo { static Foo() {} } Even though that's not valid code (which I'd previously forgotten) it may need to be represented within... more 11/7/2014 1:03:42 PM
This is the problem, I suspect: byte[] compressed = System.Text.Encoding.UTF8.GetBytes(childNodes.Item(i).InnerText.Trim()); You said that your data is compressed and then base64-encoded... but your code doesn't use base64 anywhere,... more 11/7/2014 1:01:07 PM
You have several tasks, each of which is modifying the same shared resource in a non-atomic way. mesg += "\nTask" + a; is effectively: mesg = mesg + "\nTask" + a; ... so if one task reads mesg, then another task writes a new value to... more 11/7/2014 12:56:53 PM
Why it is necessary for the out parameter to be assigned to before it leaves the current method? Think of an out parameter as an extra return value. Just as you can't return from a non-void method without specifying the return value,... more 11/7/2014 11:53:32 AM
It's not clear what exactly you're trying to do. You might want: list = list.Where(emp => emp.Name == name).ToList(); or perhaps list = list.Where(emp => emp.Name.Contains(name)).ToList(); It's not at all clear why you'd be... more 11/7/2014 10:34:18 AM
Now you've given an example of how you want to call it, I suspect that using dynamic typing may be the simplest approach: public void DoSomething(params object[] values) { foreach (dynamic value in values) { // Overload... more 11/7/2014 10:10:15 AM
If you pass in int.MaxValue, that should end up with a value which is outside the representable range for DateTime, whatever the original DateTime is. Sample code, tested on csharppad.com: DateTime.MinValue.AddDays(int.MaxValue); Using... more 11/7/2014 9:40:47 AM
I would suggest using two classes - one for the JSON you're actually receiving, and then one for the object model you want to use: public class JsonUserContext { public string AccountNo { get; set; } public string AuthValue { get;... more 11/7/2014 8:20:37 AM
This is the problem: account = new createAccount(); That's not trying to call a method called createAccount - it's trying to call a constructor of a type called createAccount, and you don't have such a type. You could write: account =... more 11/6/2014 6:35:24 PM
In the console application program I create an instance of the logger class. Right - so you're creating an instance of a type which derives from Singleton<T>. (We'll leave aside the design issue of having a singleton you can... more 11/6/2014 10:19:31 AM