dev
-
현재 실행중인 함수 이름 가져오기dev/C# 2009. 9. 16. 15:56
에러 처리할 때 어느 함수에서 에러가 났는지 로그가 남으면 알기 편할 것 같아서 로거를 만들다가... 현재 실행중인 함수 이름 가져오기 using System.Reflection; void FunctionNameTest() { string currentFunction = MethodBase.GetCurrentMethod().Name; try { } catch (Exception ex) { Console.WriteLine("ERR at {0}.", currentFunction); } finally { } } 이런식으로 사용하면 된다. 더 자세한 함수 호출관계를 알려면 StackTrace, StackFrame, MethodBase 클래스들을 잘 섞어쓰면 된다. (관련예제 자세한 것 http://www.cod..
-
Process 실행dev/C# 2009. 9. 14. 21:31
using System.Diagnostics; Process.Start(@"D:/runtest/run.exe");
-
(UserControl) DependencyProperty & RoutedEvent 만들기dev/wpf 2008. 8. 14. 05:28
UserControl에 DependencyProperty 만들기 MyControl이라는 UserControl에 double형의 값을 갖는MyValue라는 Property를 만들고, MyValue의 값이 변경되면 event를 발생시키려고 할 때 C# Code UserControl MyControl Class public static readonly DependencyProperty MyValueProperty = DependencyProperty.Register("MyValue", typeof(double), typeof(MyControl), new FrameworkPropertyMetadata(double.NaN, new PropertyChangedCallback(OnMyValueChanged), new..
-
(UserControl) XAML에서 참조하기dev/wpf 2008. 8. 13. 02:05
UserControl, XAML에서 참조하기 UserControl 이름이 MyControl MyControl이 포함된 프로젝트가 ControlSet일 경우 local의 경우 .XAML file에 1. xmlns 추가 xmlns:local="clr-namespace:MyControl" 2. 사용 ※ local : 원하는 참조명으로 사용 외부 라이브러리의 경우 0. 프로젝트 참조에 MyControl이 포함된 dll 추가 .XAML file에 1. xmlns 추가 xmlns:controls="clr-namespace:ControlSet;assembly=ControlSet" 2. 사용 ※ controls: 원하는 참조명으로 사용