C
C#

help

Use reflection to get type of abstract base class [Answered]

TTvde19/19/2022
I have the following setup:
abstract class Formatter<T> { }
class StringFormatter : Formatter<string> { }
abstract class Formatter<T> { }
class StringFormatter : Formatter<string> { }
I want to use reflection to find out what kind of formatter a certain type is
Type type = typeof(StringFormatter);
string typeName = ??? // should be "string"
Type type = typeof(StringFormatter);
string typeName = ??? // should be "string"
How do I go about getting this? Btw there is no reflection tag Maybe Type.GetTypeInheritance() is a good place to start?
TTvde19/19/2022
Thanks!
AAccord9/19/2022
✅ This post has been marked as answered!

Looking for more? Join the community!

Want results from more Discord servers?
Add your server
Recommended Posts
automapper in net frameworkhi all, i tried to implement automapper using net framework 4.7.2, i tried in net core im able to coResponseCache duration in minutes instead secondsCan I set or convert values from seconds to minutes for the [ResponseCache (Duration = 3600)] attribQuery over multiple entities using the same interface [Answered]I have a EF setup, where ~20 entities implement `IArchivable` This interface has a public ```cs publCustom Class SerializationIs it possible to use a custom JSON serializer on a class? For example, I have a class with a few prWhat am I doing wrong with this deserialized data?When I run my program i'm only getting nulls and zero's when trying to access card prices from the jProcessI want to know when ANY new process is started and I want to get the path of the file that ran the pIssue with JSON SerialisationWhen converting from object to json i need my list of object to be as follows "group": [{ "item": {}Mapster EqualityComparisonHi. How i can pass self reference to nested method of mapping?Bridging the gap between Linq expression trees and Roslyn parseTrying to make a script generator that converts C# code and so far I'm using Linq expressions for thComposing a validation function using functional conceptsHey yall, I've been trying to get into using and applying functional concepts in some of my projectshow to add to list [Answered]um so i want to add numbers to list until user inputs 0 and then print sum average etc but idk how teasy movementhow do I just make easy movement in my 2D game...EF-Core data reference [Answered]So for school we have to make a Restaurant management system. Now I am working on Reservations with A ready-made ef core data search solutionHi, I need to do a database content search engine. I would like the search engine to look for a word