示例#1
0
        /*
         * Get a list of all the types from which the current
         * class is derived. This includes the base class and
         * any interfacess. If the class is not explicitly
         * derived from a class return System.Object as the
         * base class.
         */

        protected List <String> GetCodeBaseTypeList(string source)
        {
            List <String> list = new List <String>();

            source = CSharpFormattingTools.RemoveClassDefinitions(source);

            Regex re = new Regex(@"(?s)class\s+[\w]+\s*:?\s*[global::]*([\w\s\.,]*)\s*\{");
            Match m  = re.Match(source);

            if (m.Success)
            {
                string types = m.Groups[1].Value;

                if (!String.IsNullOrEmpty(types))
                {
                    string[] split = types.Split(',');
                    foreach (string s in split)
                    {
                        list.Add(s.Trim());
                    }
                }
            }

            return(list);
        }