I have a Member class in a project. I find this class by using powershell on package manager console in Visual Studio.
public class Member : ICacheable
{
public string FirstName;
public string LastName;
...
}
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.
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
UPDATE (SOLUTION)
Note: $memberItem is a ProjectItem that I showed you at above.
$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 :
I'm not sure how things work in the package manager console, but in powershell you can check if a compiled(and loaded) type implements interfaces using the implementedinterfaces
property. Ex. with array
-type:
#[array].ImplementedInterfaces.Contains([System.Collections.ICollection])
[array].ImplementedInterfaces.Contains([type]"System.Collections.Icollection")
True
You can see all implemented interfaces with:
[array].ImplementedInterfaces
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True False ICloneable
True False IList
True False ICollection
True False IEnumerable
True False IStructuralComparable
True False IStructuralEquatable
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With