Relative Content

Tag Archive for c#.netroslynsourcegenerators

Find all derived classes in a source generator

My source generator needs to find other classes that derive from the inspected class to know whether special code needs to be added. So far, I have only inspected the class to augment itself and followed references from there, like the type of class properties, but not any other classes that also exist in the project that uses the source generator. I can’t seem to find any methods or interfaces or web documentation for this. Is this even possible and how would that work?

Find all derived classes in a source generator

My source generator needs to find other classes that derive from the inspected class to know whether special code needs to be added. So far, I have only inspected the class to augment itself and followed references from there, like the type of class properties, but not any other classes that also exist in the project that uses the source generator. I can’t seem to find any methods or interfaces or web documentation for this. Is this even possible and how would that work?