Código
#Region " Get OS Architecture Function " ' [ Get OS Architecture Function ] ' ' // By Elektro H@cker ' ' Examples : ' Dim Architecture = Get_OS_Architecture() Private Function Get_OS_Architecture() As Integer Dim Bits = Runtime.InteropServices.Marshal.SizeOf(GetType(IntPtr)) * 8 Select Case Bits Case 32 : Return 32 ' x86 Case 64 : Return 64 ' x64 Case Else : Return Nothing ' xD End Select End Function #End Region
Ejemplo de un overload
Código
' Examples: ' ' Test(0) ' Test"0") Sub Test(ByVal Argument As Integer) MsgBox("Integer: " & Argument) End Sub Sub Test(ByVal Argument As String) MsgBox("String: " & Argument) End Sub
El snippet de Get All Files, mejorado:
Código
#Region " Get All Files Function " ' [ Get All Files Function ] ' ' // By Elektro H@cker ' ' Examples: ' ' Dim Files As Array = Get_All_Files("C:\Test", True) ' For Each File In Get_All_Files("C:\Test", False) : MsgBox(File) : Next Private Function Get_All_Files(ByVal Directory As String, Optional ByVal Recursive As Boolean = False) As Array If System.IO.Directory.Exists(Directory) Then If Not Recursive Then : Return System.IO.Directory.GetFiles(Directory, "*", IO.SearchOption.TopDirectoryOnly) Else : Return IO.Directory.GetFiles(Directory, "*", IO.SearchOption.AllDirectories) End If Else Return Nothing End If End Function #End Region