C# | Type.GetDefaultMembers() Method Last Updated : 11 Jul, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report Type.GetDefaultMembers() Method is used to find the members defined for the current Type whose DefaultMemberAttribute is set. Syntax: public virtual System.Reflection.MemberInfo[] GetDefaultMembers (); Return Value: This method returns an array of MemberInfo objects representing all default members of the current Type or an empty array of type MemberInfo, if the current Type does not have default members. Below programs illustrate the use of Type.GetDefaultMembers() Method: Example 1: csharp // C# program to demonstrate the // Type.GetDefaultMembers() Method using System; using System.Globalization; using System.Reflection; class GFG { // Main Method public static void Main() { // Declaring and initializing obj object obj = "Ram"; // Getting the type of obj // using GetType() Method Type type = obj.GetType(); // Getting the DefaultMembers // using GetDefaultMembers() Method MemberInfo[] info = type.GetDefaultMembers(); // Display the result for (int i = 0; i < info.Length; i++) Console.WriteLine("Result is: {0}", info[i]); } } Output: Result is: Char Chars [Int32] Example 2: csharp // C# program to demonstrate the // Type.GetDefaultMembers() Method using System; using System.Globalization; using System.Reflection; // Setting DefaultMemberAttribute [DefaultMemberAttribute("name")] class GFG { // Main Method public static void Main() { // Declaring and initializing // object of Type dataType Type type = typeof(GFG); // Getting the DefaultMembers // using GetDefaultMembers() Method MemberInfo[] info = type.GetDefaultMembers(); if (info.Length != 0) { for (int i = 0; i < info.Length; i++) Console.WriteLine("Result is: {0}", info[i]); } else { Console.WriteLine("DefaultMember is not found"); } } // Defining Member Attributes public void Name(String s) {} // Defining property public String name { // property or indexer must // have at least one accessor get { return "Ram"; } } } Output: Result is: System.String name Reference: https://learn.microsoft.com/en-us/dotnet/api/system.type.getdefaultmembers?view=netframework-4.8 Comment More infoAdvertise with us Next Article C# | Type.GetMembers() Method R rohitprasad3 Follow Improve Article Tags : C# CSharp-method CSharp-Type-Class Similar Reads C# | Type.GetMembers() Method Type.GetMembers() Method is used to get the members (properties, methods, fields, events, and so on) of the current Type. There are 2 methods in the overload list of this method as follows: GetMembers() Method GetMembers(BindingFlags) Method GetMembers() Method This method is used to return all the 4 min read C# | Type.GetMembers() Method Type.GetMembers() Method is used to get the members (properties, methods, fields, events, and so on) of the current Type. There are 2 methods in the overload list of this method as follows: GetMembers() Method GetMembers(BindingFlags) Method GetMembers() Method This method is used to return all the 4 min read C# | Type.GetMember() Method Type.GetMember() Method is used to get the specified members of the current Type. There are 3 methods in the overload list of this method as follows: GetMember(String) Method GetMember(String, BindingFlags) Method GetMember(String, MemberTypes, BindingFlags) Method GetMember(String) Method This meth 6 min read C# | Type.GetMember() Method Type.GetMember() Method is used to get the specified members of the current Type. There are 3 methods in the overload list of this method as follows: GetMember(String) Method GetMember(String, BindingFlags) Method GetMember(String, MemberTypes, BindingFlags) Method GetMember(String) Method This meth 6 min read C# | Type.GetInterfaces() Method Type.GetInterfaces() Method is used to get all the interfaces implemented or inherited by the current Type when overridden in a derived class. Syntax: public abstract Type[] GetInterfaces ();Return Value: This method returns an array of Type objects representing all the interfaces implemented or inh 2 min read C# | Type.GetInterfaces() Method Type.GetInterfaces() Method is used to get all the interfaces implemented or inherited by the current Type when overridden in a derived class. Syntax: public abstract Type[] GetInterfaces ();Return Value: This method returns an array of Type objects representing all the interfaces implemented or inh 2 min read Like