Browsing 7239 questions and answers with Jon Skeet
No, there's no way of doing this. If you look at the generator code (primitive fields, message fields, enum fields etc) you can see that the ...Count() methods (both interface and implementation) are written... more 1/19/2016 4:07:19 PM
There's no need to use the conditional operator at all here... I suspect you want a where clause of: where opbleftjoin.CmnCalendarYearId == clndrId && (empId == 0 || emp.Id == empId) && (dptId == 0 ||... more 1/19/2016 3:04:09 PM
My problem is that I don't want that to be sent, I am making sure that the string I am sending it has no extra white space at the end to create this. No, you're not. Look at your code: sendingStream.println("00 0012552 003365... more 1/18/2016 5:13:42 PM
XDocument.Load doesn't know anything about mapping paths. Instead, you should use HttpServerUtility.MapPath to map the path, then pass the result into XDocument.Load: var path =... more 1/18/2016 4:57:41 PM
The existing answers talk about this being a C# 6 feature without a .NET framework component. This is entirely true of nameof - but only somewhat true of string interpolation. String interpolation will use string.Format in most cases,... more 1/18/2016 4:47:41 PM
The simplest approach for writing a multi-line file is File.WriteAllLines: File.WriteAllLines(@"c:\Downloads\test.txt", new[] { "this is line one", "", "", "this is line 2" }); The empty strings are there because in your original... more 1/18/2016 1:35:29 PM
You need to make the query include the value from the textbox. SQL Server doesn't know anything about your textbox - you've just provided the text textBox1.Text as if it refers to something that SQL Server knows about. However, you... more 1/18/2016 6:58:00 AM
It's the argument which is null, so you should throw an ArgumentNullException. You should basically never throw NullReferenceException directly - it should only get thrown (automatically) when you try to dereference a null value. The fact... more 1/17/2016 5:30:14 PM
I suspect you just want: List<string> names = useFullProcess ? result.Cast<Class2>().Select(x => x.ID.ToString()).ToList() : result.Cast<Class1>().Select(x => x.Name).ToList(); You can use a cast within... more 1/15/2016 8:04:30 AM
It's implementation-specific at least to some extent. For example, Dictionary<,> allows you to specify an IEqualityComparer<T> to use to check keys for equality, and SortedDictionary<,> doesn't use Equals and GetHashCode... more 1/14/2016 8:58:34 AM