Hot answers tagged

2

There are several ways how you can process an XML using Linq2XML. As I can understand you want to process only those XML files that are matching a given format. You can check this with XML native tools, like XSD or DTD schema definitions and validation or manually via XLinq. If you want to check that with XLinq I would suggest to use the following methods: ...


2

It looks to me that you can filter the data in the original query, instead compiling the query then filtering it. It's difficult to suggest an exact solution without access to the required objects and collections, but something like this can give you a start: public List<News> GetNewsbyYear(int NewsId, int Year, int CategoryId) { using (var db = ...


1

I would suggest a two lines of code solution instead of one. :) Let me show you first the solution then the explanation. Solution private static readonly Lazy<IEnumerable<string>> enumValues = new Lazy<IEnumerable<string>>(() => Enum.GetValues(typeof(AttributesInMethod)).Cast<AttributesInMethod>().Select(option => option....


Only top voted, non community-wiki answers of a minimum length are eligible