Browsing 7239 questions and answers with Jon Skeet
Yes, dbRow is only in scope within the equals part of the join. However, you're not using your r range variable - which contains the matched rows for the current addRow... or null. Just change each dbRow in the select to r. But then work... more 12/11/2015 5:57:41 PM
I would use something like: foreach (var prop in vm.GetType() .GetProperties() .Where(x => x.GetCustomAttributes<ExportAttribute>().Any())) { var list = (IEnumerable)... more 12/11/2015 5:48:26 PM
Here's an example for adding a new root element: using System; using System.Xml; class Test { static void Main() { XmlDocument doc = new XmlDocument(); doc.Load("test.xml"); var originalRoot =... more 12/11/2015 5:20:45 PM
Yes, basically some members are available on some platforms but not others. Look at the version information for CultureInfo(int) constructor vs CultureInfo.DateTimeFormat in the Version Information section, as an example. Constructor... more 12/11/2015 5:10:53 PM
System.Windows.Rect is a structure. Therefore a copy of the struct is returned by the property, rather than a copy of a reference to an object. Modifying the returned value does nothing, as it's a copy of the value that's actually stored... more 12/11/2015 4:56:59 PM
Sounds like you need generics instead: public class BaseClass<T> where T : BaseProperty { public T Property { get; set; } } public class DerivedClass : BaseClass<DerivedProperty> { public void MethodExample() { ... more 12/11/2015 4:24:16 PM
Your values are in a different order to the columns you've specified, basically. You're trying to populate: MRNumber: 'ABC124' Address: 'Billi' Age: 'Billa' Gender: 'Rafa' Contact: 21 CNIC: 'Female' Consultant: '123' PatientName:... more 12/11/2015 3:04:05 PM
You're implicitly calling ToString() on a List<T>. That doesn't do what you expect it to, because List<T> doesn't override ToString(). You can use // Note: the ToArray() call is only required if you're targeting .NET 3.5,... more 12/11/2015 1:40:09 PM
You go to your project properties page, and in Build tab, find the "Treat warnings as errors" radio button, then select "None" - or just specific warnings that you want to highlight as errors. more 12/11/2015 12:10:27 PM
Your current approach is very inefficient - it's O(N * M) and it creates a list on each iteration. Using a join would be more efficient - I would still use a foreach loop, but separate the querying part from the update part: var... more 12/11/2015 12:08:51 PM