I have an object, I would like to print all its parent type to Object? How to do it?
If you are only interested in the class hierarchy:
Type type = obj.GetType(); while (type != null) { Console.WriteLine(type.Name); type = type.BaseType; }
var t = obj.GetType(); while (t != null) { Console.WriteLine(t.Name); t = t.BaseType; }
Type currentType = obj.GetType(); while (currentType != null) { Console.WriteLine(currentType.ToString()); currentType = currentType.BaseType; }
Source: https://habr.com/ru/post/906405/More articles:Google Charts in Rails 3.1 Ajax Partial - javascriptUndefined action method for Formtastic :: FormBuilder - ruby-on-railshttps://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/906402/restrict-access-to-just-some-source-code-in-team-foundation-server-2010&usg=ALkJrhiao2UxkzNSriS3ghVBCIyyAqK2OwUsing NSThread mode in NSOperation - iosInstance level access control in Apache Shiro - javaGet type inheritance tree - inheritanceHow to run common code for most requests in my Spring MVC web application? - javaMethods for determining acoustic similarity (but not fingerprints) - audioHow to check if two generics have base subclass relationships without creating them? - genericsHide scrollbars in DataGridView - c #All Articles