Browsed by
Category: Visual Basic .NET

VB.NET to C# – 04
Making decisions

VB.NET to C# – 04
Making decisions

Making decisions is one of the most used tasks when writing business logic. In Visual Basic .NET you use in most cases an If .. Then .. Else statement or a Select Case statement. In C# there is no big difference, beside the fact that the naming of the keywords is a bit deviant.

Visual Studio 2017
Use ValueTuples in Visual Basic .NET

Visual Studio 2017
Use ValueTuples in Visual Basic .NET

Tuples are primitive types where you can easily combine multiple values to one variable. They are as a datatype not completely new for C# 7.0 or Visual Basic 15, but the way you can use them are, with the new System.ValueTuple type, is much improved. In this post I will show you how you can take advantage of the streamed syntax of value tuples.

VB.NET to C# – 02
Working with data types

VB.NET to C# – 02
Working with data types

The Common Type System (CTS) ensures that components written in C# or VB.NET can interact with each other. The CTS supports two general categories of types: Value types and Reference types. Value types directly contain data. An instance of a value type is either allocated on the stack or allocated inline in a structure. These types can be natively built-in (native data types), user-defined or enumerations. A reference type, in contrast to a value type, stores a reference to the value’s…

Read More Read More

Year first date literals in Visual Basic .NET

Year first date literals in Visual Basic .NET

Since I write on a daily base unit tests, I’m wondering more and more why there is not an easy – and especially unambiguous – way to provide a hardcoded date to a variable or procedure argument. Do you know, without any doubt, what this date actually means? Was I born on the 5th of June or the 6th of May? Visual Basic .NET will support now a good ISO-standard, which starts with the year. It follows the convention of…

Read More Read More

Show generated SQL of Entity Framework in Visual Basic .NET

Show generated SQL of Entity Framework in Visual Basic .NET

When you are writing LINQ queries against an Entity Framework context, you don’t have to worry about the SQL which is generated and executed. However, in some cases you may be interested in this SQL. It’s quite easy to switch on a logging mechanism which will be display all executed SQL in your Debug window. You have to provide an Action to the DbContext.Database.Log property. You provide a lambda with the functionality you want. If you want you can log…

Read More Read More