Question:
How can one create an object that when its operators, such as:
1 2 3 |
operator > (Object obj1, Object obj2) operator < (Object obj1, Object obj2) |
, are overridden PowerShell utilizes these operators?
Such that:
1 2 |
where-object { $CustomObject -gt 12 } |
would call:
1 2 |
public static bool operator > (Object object1, Object object2) |
Is it possible?
To clarify:
- The object exists within a .NET assembly
- The object has overridden comparision operators
- PowerShell does not seem to honor these operators
Answer:
I do not believe you can do operator overloading in Powershell.