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 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

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

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