Tag Archives: C#

Mocking “this”

Let’s assume we have a simple service that is also using an inner service, providing a few operations as follows: public interface IService {     string A();     string B();     string C(); } public class Service : IService {     private readonly IInnerService innerService;     public Service(IInnerService innerService)     {         this.innerService = innerService;     }     public string A()     {         return “A”;     }     public string B()     {         return b(); … Continue reading

Posted in .NET, C# | Tagged , , , | Leave a comment

Invariant string interpolation

I’m sure you like C# string interpolation support ($”{…}”): var start = DateTime.Now; var end = start.AddDays(7); string weekIntervalText = $”{start}-{end}”; But you also know that this uses the current thread’s culture to format the string, so you think “Oh, … Continue reading

Posted in C# | Tagged , , , , | Leave a comment

Auto-disposing? Empty using syntax?

What do you think? Should this code auto-dispose the X object instance created but not used? If you test it, you’ll see it does not: public class X : IDisposable { … } static void Main(string[] args) {     … Continue reading

Posted in C# | Tagged , , , | Leave a comment

Bridging

When you, a Microsoft technology-oriented developer, write software today you have to select the target platforms you would like to support. The platforms are then used to select the tools, technologies, and programming languages you can use for coding the different layers of … Continue reading

Posted in .NET, Architecture, C#, Development, JavaScript, Unity | Tagged , , , , | Leave a comment

Non-game 3D apps in Unity

HoloLens (and more generally, Windows Holographic) is around the corner and will transform the way people interact with devices and their expectancies from them. Holograms and 3D gestures are the new user interface elements you need to consider when you develop … Continue reading

Posted in HoloLens, Unity, UWP | Tagged , , , | 1 Comment

A single line after if shouldn’t require {braces}

I saw many C# style guidelines (or even enterprise standards) requiring that the code statements within of if (or else, or else if) clause should always require braces ({, }), even when there is a single statement to run. I feel … Continue reading

Posted in .NET, C# | Tagged , , , , | Leave a comment

Component development decision: low level or high level techologies?

If you want to develop software components targeting other developers and their projects, you should carefully decide what technologies would you develop for and support: Low level technologies, e.g. C++ or JavaScript (HTML5); High level technologies, e.g. .NET (WPF/Windows Forms/ASP .NET) or … Continue reading

Posted in Architecture | Tagged , , , , | Leave a comment