VB.net Program to Demonstrate the Empty Property of String Class

You are currently viewing VB.net Program to Demonstrate the Empty Property of String Class

VB.Net program to demonstrate the Empty property of String class

'VB.NET program to demonstrate the Empty property 
'of String class.

Imports System

Module Module1
    Sub Main()
        Dim str1 As String
        Dim str2 As String = "Hello World"

        If (str1 = String.Empty) Then
            Console.WriteLine("String str1 is empty")
        Else
            Console.WriteLine("String str1 is not empty")
        End If

        If (str2 = String.Empty) Then
            Console.WriteLine("String str2 is empty")
        Else
            Console.WriteLine("String str2 is not empty")
        End If
    End Sub
End Module
String str1 is empty
String str2 is not empty
Press any key to continue . . .

Ranjith Kumar

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Reply