ServiceStack.Host.XsdMetadata.GetBaseTypeWithTheSameName C# (CSharp) Méthode

GetBaseTypeWithTheSameName() public static méthode

Gets the name of the base most type in the heirachy tree with the same. We get an exception when trying to create a schema with multiple types of the same name like when inheriting from a DataContract with the same name.
public static GetBaseTypeWithTheSameName ( Type type ) : Type
type System.Type The type.
Résultat System.Type
        public static Type GetBaseTypeWithTheSameName(Type type)
        {
            var typesWithSameName = new Stack<Type>();
            var baseType = type;
            do
            {
                if (baseType.GetOperationName() == type.GetOperationName())
                    typesWithSameName.Push(baseType);
            }
            while ((baseType = baseType.BaseType()) != null);

            return typesWithSameName.Pop();
        }
    }