Names starting with I
are usually interfaces. They are not the classes in which you instantiate, they are contracts that determine that a particular class implements a certain known set of functionality.
For example, [hashtable]
implements IEnumerable
. This means that everyone knows how to work with the IEnumerable
interface and work with this class; you can create your own class that implements the interface, and code that you could never know about your class or what it does can still interact with it as defined by IEnumerable
(which in this case is a way to iterate over it )
So, when a function declares a parameter with an interface type, it is not looking for any particular class, it is looking for any class that implements this interface.
The next step is to find out which types implement this interface. Here are some PowerShell codes I used to search:
[System.AppDomain]::CurrentDomain.GetAssemblies().GetTypes() | Where-Object { [System.Management.Automation.Language.IScriptExtent].IsAssignableFrom($_) }
From this one can see the following:
IsPublic IsSerial Name BaseType -------- -------- ---- -------- True False IScriptExtent False False InternalScriptExtent System.Object False False EmptyScriptExtent System.Object True False ScriptExtent System.Object
The first list is the interface itself. Of the other three, two of them are not public, so just ScriptExtent
.
You can create one of them using New-Object
, but you need to specify the start and end positions as [ScriptPosition]
. I'm not quite sure what this should be without seeing more of your code.
source share