Find all types reachable from a given type #72362
Unanswered
dennis-yemelyanov
asked this question in
Q&A
Replies: 1 comment 4 replies
-
You should use SymbolFinder along with whatever logic you think encodes the semantics you need here. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have some object graph that needs to be serialized, and I need to find all types that may participate in this serialization (so I can do some analysis on these types). For example, for a given
Order
classI want to find types like
Customer
,OrderItem
andOrderDetail
(for simplicity let's say all these classes are sealed, I don't have to find types that derive from them).I know one approach is to use a
SymbolVisitor
, but it looks like I need to write quite some code in this case, and I'm also not sure if things like generic type arguments will be handled automatically or I need to have this processing logic in my code.Are there any other potentially better or high level approaches to do this?
Roslyn seems to have a lot of useful classes like
SymbolFinder
(not sure if it can be used for this scenario actually), but it's a bit difficult for me to discover all available options. So I want to make sure I don't end up reinventing the wheel if I miss some really good optionBeta Was this translation helpful? Give feedback.
All reactions