What is a singleton in C#?

A singleton is a class which only allows one instance of itself to be created – and gives simple, easy access to said instance. The singleton premise is a pattern across software development. There is a C# implementation “Implementing the Singleton Pattern in C#” covering most of what you need to know – including some … Read more

IOException: The process cannot access the file ‘file path’ because it is being used by another process

What is the cause? The error message is pretty clear: you’re trying to access a file, and it’s not accessible because another process (or even the same process) is doing something with it (and it didn’t allow any sharing). Debugging It may be pretty easy to solve (or pretty hard to understand), depending on your … Read more

What’s the difference between .NET Core, .NET Framework, and Xamarin?

You should use .NET Core, instead of .NET Framework or Xamarin, in the following 6 typical scenarios according to the documentation here. 1. Cross-Platform needs Clearly, if your goal is to have an application (web/service) that should be able to run across platforms (Windows, Linux and MacOS), the best choice in the .NET ecosystem is to … Read more

I am getting Failed to load resource: net::ERR_BLOCKED_BY_CLIENT with Google chrome

These errors are usually generated from an ad blocking plugin, such as Adblock Plus. To test this use either a different browser or uninstall the ad blocking plugin (right clicking the extension by the URL bar and clicking “Remove from Chrome…”). There is an easier way to temporarily disable an extension. In Chrome, opening an … Read more

What is a NullReferenceException, and how do I fix it?

What is the cause? Bottom Line You are trying to use something that is null (or Nothing in VB.NET). This means you either set it to null, or you never set it to anything at all. Like anything else, null gets passed around. If it is null in method “A”, it could be that method “B” passed a null to method “A”. null can have different meanings: Object variables … Read more

How can I convert String to Int?

Try this: or better yet: Also, since Int32.TryParse returns a bool you can use its return value to make decisions about the results of the parsing attempt: If you are curious, the difference between Parse and TryParse is best summed up like this: The TryParse method is like the Parse method, except the TryParse method does not throw an exception if the conversion … Read more

An existing connection was forcibly closed by the remote host

This generally means that the remote side closed the connection (usually by sending a TCP/IP RST packet). If you’re working with a third-party application, the likely causes are: You are sending malformed data to the application (which could include sending an HTTPS request to an HTTP server) The network link between the client and server … Read more

What is a NullReferenceException, and how do I fix it?

What is the cause? Bottom Line You are trying to use something that is null (or Nothing in VB.NET). This means you either set it to null, or you never set it to anything at all. Like anything else, null gets passed around. If it is null in method “A”, it could be that method “B” passed a null to method “A”. null can have different meanings: Object variables … Read more

.Net 4.8 Support for Windows 10 ends in 26 days?

From what I understand, since Microsoft will not be releasing any new versions of .Net Framework, they have committed to supporting 4.8 indefinitely: .NET Framework 4.8 is the last version of .NET Framework, and no further versions will be released. However, .NET Framework will continue to be serviced with monthly security and reliability bug fixes. Additionally, … Read more