Does .NET have a way to check if List a contains all items in List b?

If you’re using .NET 3.5, it’s easy: public class ListHelper<T> { public static bool ContainsAllItems(List<T> a, List<T> b) { return !b.Except(a).Any(); } } This checks whether there are any elements in b which aren’t in a – and then inverts the result. Note that it would be slightly more conventional to make the method generic … Read more

“NotSupportedException” when WebRequest is unable to find a creator for that prefix

Try this hacky workaround on this issue: private static HttpWebRequest CreateWebRequest(Uri uri) { var type = Type.GetType(“System.Net.HttpRequestCreator, System, Version=4.0.0.0,Culture=neutral, PublicKeyToken=b77a5c561934e089”); var creator = Activator.CreateInstance(type,nonPublic:true) as IWebRequestCreate; return creator.Create(uri) as HttpWebRequest; }

Is Mono ready for prime time? [closed]

There are a couple of scenarios to consider: (a) if you are porting an existing application and wondering if Mono is good enough for this task; (b) you are starting to write some new code, and you want to know if Mono is mature enough. For the first case, you can use the Mono Migration … Read more

.NET Core vs Mono

Necromancing. Providing an actual answer. What is the difference between .Net Core and Mono? .NET Core now officially is the future of .NET. It started for most part with a re-write of the ASP.NET MVC framework and console applications, which of course includes server applications. (Since it’s Turing-complete and supports interop with C dlls, you … Read more

Most useful NLog configurations [closed]

Some of these fall into the category of general NLog (or logging) tips rather than strictly configuration suggestions. Here are some general logging links from here at SO (you might have seen some or all of these already): log4net vs. Nlog Logging best practices What’s the point of a logging facade? Why do loggers recommend … Read more

Process.start: how to get the output?

When you create your Process object set StartInfo appropriately: var proc = new Process { StartInfo = new ProcessStartInfo { FileName = “program.exe”, Arguments = “command line arguments to your executable”, UseShellExecute = false, RedirectStandardOutput = true, CreateNoWindow = true } }; then start the process and read from it: proc.Start(); while (!proc.StandardOutput.EndOfStream) { string … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)