Relative Content

Tag Archive for c#.net

Microsoft.Data.SqlClient Datalayer Equivalent

in Microsoft.Data.SqlClient wich is the equivalent of System.Data.SQLClient DataLayer?
I’m rewriting an old procedure from fired collaborator and now I have that problem…
It’s a simple question I know… but I found nothing on the web…

Combine classes which are different only in async/sync method calls

I want to remove the code duplication, I have a base abstract class A defined in a separate assembly and derived classes B, C (each in a separate assembly), which are different only by calling a sync or async versions of methods. I want to move all the logic to the base class to remove code duplication. I’ve tried adding virtual methods to the base class for sync and async versions (Evaluate and EvaluateAsync), but it is not the best choice as they will be publically visible and will confuse the customers when to call any of them.

Unexpected behavior with Thread.Sleep(1) in C# loop

When I first compiled and executed this code segment (excluding the commented statements), it seemed that the loop didn’t wait for 1 millisecond (which usually takes about ten to twenty milliseconds) before executing other code. Because the code I use to do other things depends on waiting for a millisecond (usually ten to twenty milliseconds) on the first iteration of the loop, it resulted in an error. Then, I modified the code slightly (adding the commented statements), and subsequent executions were all normal. Why did this happen?

DLLImport not picking up the DLL

I just started a new job with a government agency. There has been a piece of software working which was created way before my time This software uses DLL Import to import a third party DLL called Leadtools.
We created a new version of this software, however the code that calls the DLLImport throws the following error: