Tag: .NET
-
How to copy a file and report progress in C# using P/Invoke
One of the main missing APIs in the .NET Base Class Library is the ability to report progress while copying a large file. We do have the File.Copy and FileInfo.CopyTo methods but there’s no way to report how much data has been copied. Even worse, these methods are not asynchronous, meaning that the calling thread…
-
The essentials of the Aggregate method
The Aggregate method combines a sequence of elements into a single value. It does that by iterating over each one of them and calling a lambda function. This lambda function produces a result and carries it on to the next iteration. The simplest form The following example calculates the sum of some numbers: In comparison,…
-
❓Stop Asking ‘Is C# Compiled or Interpreted?’ — Here’s Why
Is C# compiled or interpreted? This is a question that comes up very often in interviews involving C# and .NET. And in my opinion, it is the wrong question. An interviewer is asking a potential candidate this question in order to trick them into giving the wrong answer. Let me explain. The Problem Because, if…
