Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to determine if a type implements an interface in Powershell
    text
    copied!<p>I have a Member class in a project. I find this class by using powershell on package manager console in Visual Studio. </p> <pre><code>public class Member : ICacheable { public string FirstName; public string LastName; ... } </code></pre> <p>It prints something like below. How to check this class is assignable to ICacheable or not. Actaully I am trying to find all the classes that implements ICacheable but I couldnt find any property that will help me to find this.</p> <pre><code>IsDirty : False FileCount : 1 Name : Member.cs Collection : System.__ComObject Properties : System.__ComObject DTE : System.__ComObject Kind : {6BB5F8EE-4483-11D3-8BCF-00C04F8EC28C} ProjectItems : System.__ComObject Object : System.__ComObject ExtenderNames : {} ExtenderCATID : {610D4615-D0D5-11D2-8599-006097C68E81} Saved : True ConfigurationManager : FileCodeModel : System.__ComObject Document : System.__ComObject SubProject : ContainingProject : System.__ComObject </code></pre> <p><strong>UPDATE (SOLUTION)</strong></p> <p>Note: $memberItem is a ProjectItem that I showed you at above.</p> <pre><code>$memberItem.FileCodeModel.CodeElements | % { $_.Children | % { $_.ImplementedInterfaces } } DTE : System.__ComObject Collection : System.__ComObject Name : ICacheable FullName : ApplicationBase.Core.Interface.ICacheable ProjectItem : Kind : 8 IsCodeType : True InfoLocation : 2 Children : Language : {B5E9BD34-6D3E-4B5D-925E-8A43B79820B4} StartPoint : EndPoint : ExtenderNames : {ExternalLocation} ExtenderCATID : Parent : System.__ComObject Namespace : System.__ComObject Bases : System.__ComObject Members : System.__ComObject Access : 1 Attributes : System.__ComObject DocComment : Comment : DerivedTypes : IsGeneric : False DataTypeKind : 1 Parts : </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload