Adis1102
Adis1102

Reputation: 212

Where to find predefined classes, methods, functions and so on?

I am new to Powershell and programming in general. I came across the following $Date = [datetime]::MinValue. As I am learning PS I came across methods, functions and classes.

As I understand [datetime] is a class, now I am wondering how can I Get all classes in Powershell? I d like to take a look at them go through them get some awareness what to use as requirements are arising...

Is there also something more than cmdlet, methods, functions and classes (not that these wouldnt be enough)?

Upvotes: 0

Views: 66

Answers (1)

T-Me
T-Me

Reputation: 1884

The literal answer to your question would be to broad. Even if there was that single list of all classes, it would be so enormouse that you woldn't want to read it. Powershell can use .Net so there are thousends of classes, all of them separated in different namespaces. Take a look at the Microsoft Doku of the System namespace (DateTime is in there too).
So instead of learning all classes there are, start with these basic ones:

  1. string
  2. int / integer / int32
  3. array
  4. hashtable
  5. PSObject / PSCustomObject

If you come across an object (see help about_objects the most important concept in PowerShell) and you want to know what it is, use .GetType() and use your favorite search engine to find the Microsoft Doku:

(Get-Date).GetType()

Btw. the [datetime] in [datetime]::MinValueis not a class but an accelerator. An accelerator is just an alias for a class. Here you can read more about accelerators.

Upvotes: 1

Related Questions