The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My work

  • My badges

  • Twitter Updates

  • My Flickr Stream

    20140508-Delphi-2007--Project-Options--Cannot-Edit-Application-Title-HelpFile-Icon-Theming

    20140430-Fiddler-Filter-Actions-Button-Run-Filterset-now

    20140424-Windows-7-free-disk-space

    More Photos
  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,363 other followers

Archive for the ‘C#’ Category

Delphi, C#, VB.NET and SQL all have escapes to use reserved words as identifiers

Posted by jpluimers on 2014/11/04

Normally you would not want to use a reserved word as an identifier. But sometimes it can be very convenient, for instance for a code generator that wraps remoting calls or does ORM.

Both Delphi and C# have an escape for this:

The prefixes are to tell the compiler knows you really know what you are doing, and are using a reserved word as an identifier.

The cool thing: in the Run Time Type Information (Delphi) or Reflection (C# and VB.NET) you will see the names without the prefix.

Some examples from StackOverflow: Read the rest of this entry »

Posted in .NET, .NET 1.x, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, C#, C# 1.0, C# 2.0, C# 3.0, C# 4.0, C# 5.0, Delphi, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 8, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Development, Software Development, VB.NET, VB.NET 10.0, VB.NET 11.0, VB.NET 7.0, VB.NET 7.1, VB.NET 8.0, VB.NET 9.0 | Leave a Comment »

A few must watch videos on test driven development and unit testing

Posted by jpluimers on 2014/09/25

If you are going to do test driven development and unit testing, you should watch these videos and slide decks, most of them by Miško Hevery:

  1. Not a video, but a good starter: Guide: Writing Testable Code (or read the PDF version).
  2. 0:32:07 ▶ “The Clean Code Talks — Unit Testing” – YouTube.
  3. 0:37:56 ▶ The Clean Code Talks – Don’t Look For Things! – YouTube. Read the rest of this entry »

Posted in .NET, Agile, C#, Delphi, Development, Java, Java Platform, JavaScript/ECMAScript, Pascal, Scripting, Software Development, Unit Testing, VB.NET | 2 Comments »

c# – What should I do when I am forced to write unreachable code? – Stack Overflow

Posted by jpluimers on 2014/09/09

Bosak posted an interesting piece of code on StackOverflow last year. His particular code was in C#, but it does not matter what kind of compiler you use:

Sometimes a compiler will complain about unreachable code, for instance when it thinks a function never returns a value.

But you know the program logic does.

Simple solution: When you have code that never should be reached: throw an appropriate exception.

public static int GetInt(int number)
{
    int[] ints = new int[]{ 3, 7, 9, int.MaxValue };
    foreach (int i in ints)
        if (number <= i)
            return i;

    return int.MaxValue; //this should be unreachable code since the last int is int.MaxValue and number <= int.MaxValue is allways true so the above code will allways return
}

The last return could be replaced like this, as proposed by Matt Houser: Read the rest of this entry »

Posted in .NET, .NET 1.x, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, C#, C# 1.0, C# 2.0, C# 3.0, C# 4.0, C# 5.0, Development, Software Development | Leave a Comment »

NTLM authentication: Connect to TFS 2013 Git Repository with LibGit2Sharp (via: Gáspár Nagy on software)

Posted by jpluimers on 2014/08/26

I’m fighting some NTLM issues with a proxy server and this might come in handy one day: Connect to TFS 2013 Git Repository with LibGit2Sharp « Gáspár Nagy on software.

https://github.com/gasparnagy/Sample_NtlmGitTest/

–jeroen

 

Posted in .NET, C#, Development, NTLM, Power User, Software Development, Windows | Leave a Comment »

Tim Anderson on Developing an app on Microsoft Azure: a few quick reflections…

Posted by jpluimers on 2014/08/14

Very nice summary: Developing an app on Microsoft Azure: a few quick reflections….

–jeroen

Posted in .NET, .NET 4.5, C#, C# 4.0, C# 5.0, C# 6 (Roslyn), Cloud Development, Development, Software Development, Visual Studio 2013, Visual Studio 2014, Visual Studio and tools, Windows Azure | Leave a Comment »

 
Follow

Get every new post delivered to your Inbox.

Join 1,363 other followers

%d bloggers like this: