Return to Snippet

Revision: 68774
at February 23, 2015 02:51 by jatubio


Updated Code
#Sample of declare a simple powershell class with a constructor
#thanks to Tome Tanasovski (http://powertoe.wordpress.com)
function ExtendedWebClient ()
{
    param(
          [Parameter(Mandatory=$true)]
          [String]$url,
          [Parameter(Mandatory=$false)]
          [string]$timeout
    )

	$webclient = "" | Select url,timeout
	$webclient.url = $url
	$webclient.timeout = $timeout

	$webclient;
}

cls
$extclient = ExtendedWebClient "www.myurl.com" 100
$extclient

Revision: 68773
at February 23, 2015 02:33 by jatubio


Initial Code
# sample of declare a simple powershell class with a constructor
# Thanks to http://www.peterhenell.se/
function ExtendedWebClient ()
{
    param(
          [Parameter(Mandatory=$true)]
          [String]$url,
          [Parameter(Mandatory=$false)]
          [string]$timeout
    )

	$webclient = "" | Select url,timeout
    $webclient.url = $url
    $webclient.timeout = $timeout

	$webclient;
}

cls
$extclient = ExtendedWebClient "www.myurl.com" 100
$extclient

Initial URL

                                

Initial Description
Sample of declare a simple powershell class with a constructor
thanks to Tome Tanasovski (http://powertoe.wordpress.com)

Initial Title
Sample of declare a simple powershell class with a constructor

Initial Tags

                                

Initial Language
Windows PowerShell