레이블이 #컨텐트프로퍼티인 게시물을 표시합니다. 모든 게시물 표시
레이블이 #컨텐트프로퍼티인 게시물을 표시합니다. 모든 게시물 표시

2019년 1월 26일 토요일

WPF 컨텐트 프로퍼티 덤프 예제

WPF 컨텐트 프로퍼티 덤프 예제
n 비주얼 스튜디오 -> WPF 응용프로그램 , 프로젝트명 : DumpContentProperty
App.xaml, MainWindow.xaml 삭제
추가 -> 새항목 -> C# 클래스, 이름 : DumpContentProperty
생성 후 우측 솔루션 탐색기의 Properties 더블 클릭 후 출력형태를 콘솔 응용 프로그램으로 설정.
[DumpContentProperty.cs]
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Windows;
using System.Windows.Markup;
namespace DumpContentProperty
{
class DumpContentProperty
{
[STAThread]
public static void Main()
{
// PresentationCore, PresentationFramework 참조추가 되어 있어야 한다.
UIElement dummy1 = new UIElement();
FrameworkElement dummy2 = new FrameworkElement();
// 클래스와 ContentProperty를 담을 SortedList 정의
SortedList<string, string> listClass = new SortedList<string, string>();
string strFormat = "{0,-35}{1}";
// Loop through the loaded assemblies.
foreach (AssemblyName asmblyname in
Assembly.GetExecutingAssembly().GetReferencedAssemblies())
{
// Loop through the types.
foreach (Type type in Assembly.Load(asmblyname).GetTypes())
{
// Loop through the custom attributes.
// (Set argument to 'false' for non-inherited only!)
foreach (object obj in type.GetCustomAttributes(
typeof(ContentPropertyAttribute), true))
{
// Add to list if ContentPropertyAttribute.
if (type.IsPublic && obj as ContentPropertyAttribute != null)
listClass.Add(type.Name,
(obj as ContentPropertyAttribute).Name);
}
}
}
// Display the results.
Console.WriteLine(strFormat, "Class", "Content Property");
Console.WriteLine(strFormat, "-----", "----------------");
foreach (string strClass in listClass.Keys)
Console.WriteLine(strFormat, strClass, listClass[strClass]);
Console.ReadKey();
}
}
}
[실행 결과]

(C#교육동영상)C# ADO.NET 실습 ODP.NET/ODAC 설치 오라클 함수 호출 실습, C#학원, WPF학원, 닷넷학원, 자바학원

  (C#교육동영상)C# ADO.NET 실습  ODP.NET/ODAC 설치  오라클 함수 호출 실습, C#학원, WPF학원, 닷넷학원, 자바학원 https://www.youtube.com/watch?v=qIPU85yAlzc&list=PLxU-i...