Im trying to prevent duplicating an extension code For instance UrlHelper(this SomeDataEventClass e) and UrlHelper(this AnotherDataEventClass e). They are doing the same thing which is generating urls based on the class .
However is there another way to further simplify the two methods to prevent method duplication
You could make a extension method on a base class or interface that both of your classes extend/implement. This can then only use fields from the base class or interface. Or you'd need to check which type you are currently handling but that breaks the abstractions you are adding and would vouch for multiple implementations.
With Base class:
With interface: