Adding values to a C# array

You can do this way – Alternatively, you can use Lists – the advantage with lists being, you don’t need to know the array size when instantiating the list. Edit: a) for loops on List<T> are a bit more than 2 times cheaper than foreach loops on List<T>, b) Looping on array is around 2 times cheaper than looping on … Read more

Can’t use System.Windows.Forms

A console application does not automatically add a reference to System.Windows.Forms.dll. Right-click your project in Solution Explorer and select Add reference… and then find System.Windows.Forms and add it.

MSHTML DLL on Windows 10

I just created a blog post on this issue. The problem is that the Microsoft.mshtml.dll assembly in the Global Assembly Cache becomes unregistered from ActiveX during the upgrade process. To fix this issue, it is necessary to run “regasm” on the assembly: Open an instance of “Developer Command Prompt for VS2013” (or whatever version of Visual Studio … Read more

MSHTML DLL on Windows 10

I just created a blog post on this issue. The problem is that the Microsoft.mshtml.dll assembly in the Global Assembly Cache becomes unregistered from ActiveX during the upgrade process. To fix this issue, it is necessary to run “regasm” on the assembly: Open an instance of “Developer Command Prompt for VS2013” (or whatever version of Visual Studio … Read more

C# compiler error: “not all code paths return a value”

You’re missing a return statement. When the compiler looks at your code, it’s sees a third path (the else you didn’t code for) that could occur but doesn’t return a value. Hence not all code paths return a value. For my suggested fix, I put a return after your loop ends. The other obvious spot – adding an else that had a return value to the if-else-if – … Read more

How to Use TextureBrush for painting an Image

how to locally refer to the image (it is set to always copy) You can add the image to a resource file and then reference that Image from there within the code. (See link http://msdn.microsoft.com/en-us/library/7k989cfy%28v=vs.90%29.aspx) How to get the image centered in the square, and how to keep the image stationary when the square moves? This … Read more

How to Use TextureBrush for painting an Image

how to locally refer to the image (it is set to always copy) You can add the image to a resource file and then reference that Image from there within the code. (See link http://msdn.microsoft.com/en-us/library/7k989cfy%28v=vs.90%29.aspx) How to get the image centered in the square, and how to keep the image stationary when the square moves? This … Read more