I am trying to add a custom type in powershell like this:
Add-Type @'
public class MyType {
public string name;
public string type;
public hashtable data;
public string category;
}
'@
However, the type hashtable, dictionary does not exist. I have looked around for examples regarding this but could not find any.
Might add, that I do not want to use Add-Member.
Any ideas?
/Patrik
2 things:
using
statement, so the compiler can resolve the full type nameAdd-Type @'
using System.Collections;
public class MyType {
public string name;
public string type;
public Hashtable data;
public string category;
}
'@