첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
유용한 소스 코드가 있으면 icodebroker@naver.com으로 보내주시면 감사합니다.
블로그 자료는 자유롭게 사용하세요.

■ Content 속성 어트리뷰트 출력하기

----------------------------------------------------------------------------------------------------


TestProject.zip


Program.cs

 

 

using System;

using System.Collections.Generic;

using System.Reflection;

using System.Windows;

using System.Windows.Markup;

 

namespace TestProject

{

    /// <summary>

    /// 프로그램

    /// </summary>

    public class Program

    {

        //////////////////////////////////////////////////////////////////////////////////////////////////// Method

        ////////////////////////////////////////////////////////////////////////////////////////// Static

        //////////////////////////////////////////////////////////////////////////////// Public

 

        #region 프로그램 시작하기 - Main()

 

        /// <summary>

        /// 프로그램 시작하기

        /// </summary>

        [STAThread]

        private static void Main()

        {

            UIElement        uiElement        = new UIElement();

            FrameworkElement frameworkElement = new FrameworkElement();

 

            SortedList<string, string> sortedList = new SortedList<string, string>();

 

            string format = "{0,-35}{1}";

 

            foreach(AssemblyName assemblyName in Assembly.GetExecutingAssembly().GetReferencedAssemblies())

            {

                foreach(Type type in Assembly.Load(assemblyName).GetTypes())

                {

                    foreach(object attribute in type.GetCustomAttributes(typeof(ContentPropertyAttribute), true))

                    {

                        if(type.IsPublic && attribute as ContentPropertyAttribute != null)

                        {

                            sortedList.Add(type.Name, (attribute as ContentPropertyAttribute).Name);

                        }

                    }

                }

            }

 

            Console.WriteLine(format, "Class", "Content Property");

            Console.WriteLine(format, "-----", "----------------");

 

            foreach(string className in sortedList.Keys)

            {

                Console.WriteLine(format, className, sortedList[className]);

            }

        }

 

        #endregion

    }

}

 

----------------------------------------------------------------------------------------------------

Posted by 사용자 icodebroker
TAG

댓글을 달아 주세요