Class with all shared Member variables : Shared « Class « VB.Net






Class with all shared Member variables

Class with all shared Member variables
Imports System.IO

Module Module1

    Sub Main()
        Console.WriteLine("Today: " & Today.TodayDate)
        Console.WriteLine("Day: " & Today.Day)
        Console.WriteLine("Month: " & Today.Month)
        Console.WriteLine("Year: " & Today.Year)
        Console.WriteLine("Day of week: " & Today.NumericDayOfWeek)
        Console.WriteLine("Day of week: " & Today.StringDayOfWeek)
    End Sub

End Module

    Class Today
        Public Shared TodayDate As DateTime = Now()
        Public Shared Day As Integer = Now.Day()
        Public Shared Month As Integer = Now.Month()
        Public Shared Year As Integer = Now.Year()
        Public Shared NumericDayOfWeek As Integer = Now.DayOfWeek()

        Public Shared StringDayOfWeek As String = Now.DayOfWeek.ToString()
    End Class

           
       








Related examples in the same category

1.Shared Method DemoShared Method Demo
2.Use Shared method to construct ObjectUse Shared method to construct Object
3.User Shared variable to count instance numberUser Shared variable to count instance number
4.Class Shared VariableClass Shared Variable