VB.Net by API/System/Environment — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
Admin (обсуждение | вклад) м (1 версия) |
(нет различий)
|
Текущая версия на 12:51, 26 мая 2010
Содержание
- 1 Environment.CommandLine
- 2 Environment.CurrentDirectory
- 3 Environment.Exit
- 4 Environment.ExitCode
- 5 Environment.GetCommandLineArgs
- 6 Environment.GetLogicalDrives
- 7 Environment.HasShutdownStarted
- 8 Environment.MachineName
- 9 Environment.NewLine
- 10 Environment.OSVersion
- 11 Environment.ProcessorCount
- 12 Environment.SpecialFolder.CommonProgramFiles
- 13 Environment.SpecialFolder.Favorites
- 14 Environment.StackTrace
- 15 Environment.SystemDirectory
- 16 Environment.TickCount
- 17 Environment.UserDomainName
- 18 Environment.UserInteractive
- 19 Environment.UserName
- 20 Environment.Version
- 21 Environment.WorkingSet
Environment.CommandLine
Imports System
Public Class MainClass
Shared Sub Main()
Console.WriteLine("CommandLine: " & System.Environment.rumandLine )
End Sub
End Class
Environment.CurrentDirectory
Imports System
Public Class MainClass
Shared Sub Main()
Console.WriteLine("CurrentDirectory: " & System.Environment.CurrentDirectory )
End Sub
End Class
Environment.Exit
Public Class MainClass
Shared Sub Main()
System.Environment.Exit(System.Environment.ExitCode)
End Sub " ValidationError
End Class
Environment.ExitCode
Imports System
Public Class MainClass
Shared Sub Main()
Console.WriteLine("ExitCode: " & System.Environment.ExitCode )
End Sub
End Class
Environment.GetCommandLineArgs
Module Module1
Sub Main(ByVal cmdArgs() As String)
If Environment.GetCommandLineArgs.Length > 0 Then
For Each strArg As String In Environment.GetCommandLineArgs
"Process the arguments here.
Console.WriteLine(strArg)
Next strArg
End If
End Sub
End Module
Environment.GetLogicalDrives
Namespace MyApp.Info
Module Main
Sub Main()
Dim objHW As New MyApp.Info.Utilities
objHW.DisplayData()
End Sub
End Module
Public Class Utilities
"Run the application
Public Sub DisplayData()
Console.WriteLine(Environment.MachineName)
Console.WriteLine(Environment.SystemDirectory)
Console.WriteLine(Environment.GetLogicalDrives())
Console.WriteLine(Environment.Version.ToString())
End Sub
End Class
End Namespace
Environment.HasShutdownStarted
Imports System
Public Class MainClass
Shared Sub Main()
Console.WriteLine("HasShutdownStarted: " & System.Environment.HasShutdownStarted )
End Sub
End Class
Environment.MachineName
Namespace MyApp.Info
Module Main
Sub Main()
Dim objHW As New MyApp.Info.Utilities
objHW.DisplayData()
End Sub
End Module
Public Class Utilities
"Run the application
Public Sub DisplayData()
Console.WriteLine(Environment.MachineName)
Console.WriteLine(Environment.SystemDirectory)
Console.WriteLine(Environment.GetLogicalDrives())
Console.WriteLine(Environment.Version.ToString())
End Sub
End Class
End Namespace
Environment.NewLine
Imports System
Public Class MainClass
Shared Sub Main()
Console.WriteLine("NewLine: " & System.Environment.NewLine)
End Sub
End Class
Environment.OSVersion
Imports System
Public Class Step3
Shared Sub Main()
System.Console.WriteLine(System.Environment.OSVersion.ToString())
End Sub
End Class
Environment.ProcessorCount
Imports System
Public Class MainClass
Shared Sub Main()
Console.WriteLine("ProcessorCount: " & System.Environment.ProcessorCount)
End Sub
End Class
Environment.SpecialFolder.CommonProgramFiles
Imports System.Windows.Forms
public class FolderBrowserDialogProperty
public Shared Sub Main
Dim FolderBrowserDialog1 As FolderBrowserDialog = New System.Windows.Forms.FolderBrowserDialog
With FolderBrowserDialog1
.RootFolder = Environment.SpecialFolder.rumonProgramFiles
.SelectedPath = "C:\Temp"
.ShowNewFolderButton = False
.Description = "Use the tree below to select a folder:"
End With
If FolderBrowserDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
Console.WriteLine(FolderBrowserDialog1.SelectedPath)
End If
End Sub
End class
Environment.SpecialFolder.Favorites
Imports System
Imports System.Drawing
Imports System.Data
Imports System.IO
Imports System.Collections
Imports System.Windows.Forms
Imports System.Drawing.Printing
Public Class MainClass
Shared Sub Main()
Console.WriteLine(Environment.GetFolderPath(Environment.SpecialFolder.Favorites))
End Sub
End Class
Environment.StackTrace
Imports System
Public Class MainClass
Shared Sub Main()
Console.WriteLine("StackTrace: " & System.Environment.StackTrace )
End Sub
End Class
Environment.SystemDirectory
Namespace MyApp.Info
Module Main
Sub Main()
Dim objHW As New MyApp.Info.Utilities
objHW.DisplayData()
End Sub
End Module
Public Class Utilities
"Run the application
Public Sub DisplayData()
Console.WriteLine(Environment.MachineName)
Console.WriteLine(Environment.SystemDirectory)
Console.WriteLine(Environment.GetLogicalDrives())
Console.WriteLine(Environment.Version.ToString())
End Sub
End Class
End Namespace
Environment.TickCount
Option Strict On
Public Module TimerFunction
Public Sub Main()
Dim starttime, endtime As Integer
starttime = Environment.TickCount
For ctr As Integer = 0 to 10000000
Next
endtime = Environment.TickCount
Console.WriteLine("Elapsed time is {0} milliseconds", endtime - starttime)
End Sub
End Module
Environment.UserDomainName
Imports System
Public Class MainClass
Shared Sub Main()
Console.WriteLine("UserDomainName: " & System.Environment.UserDomainName)
End Sub
End Class
Environment.UserInteractive
Imports System
Public Class MainClass
Shared Sub Main()
Console.WriteLine("UserInteractive: " & System.Environment.UserInteractive)
End Sub
End Class
Environment.UserName
Public Class LoopPerformance
Shared Sub Main()
Console.WriteLine(System.Environment.UserName)
End Sub
End Class
Environment.Version
Namespace MyApp.Info
Module Main
Sub Main()
Dim objHW As New MyApp.Info.Utilities
objHW.DisplayData()
End Sub
End Module
Public Class Utilities
"Run the application
Public Sub DisplayData()
Console.WriteLine(Environment.MachineName)
Console.WriteLine(Environment.SystemDirectory)
Console.WriteLine(Environment.GetLogicalDrives())
Console.WriteLine(Environment.Version.ToString())
End Sub
End Class
End Namespace
Environment.WorkingSet
Imports System
Public Class MainClass
Shared Sub Main()
Console.WriteLine("WorkingSet: " & System.Environment.WorkingSet)
End Sub
End Class