アプリケーション構成ファイル(App.config)、Web構成ファイル(Web.config)にカスタム構成セクションを追加する † ポイントはConfigurationSection、ConfigurationElement、ConfigurationElementCollectionを継承したクラスでカスタム構成セクションを読み込む下地を作ります。あとはConfigurationManagerを使って呼び出すだけです。 メソッド名と取得する †StackTrace st = new StackTrace(true); foreach (StackFrame f in st.GetFrames()) { System.Windows.Forms.MessageBox.Show(f.GetFileColumnNumber() + "-" + f.GetMethod()); } トレースソースの作成 †http://msdn.microsoft.com/ja-jp/library/ms228984.aspx app.config によって、作成することが可能です。 レジストリへのアクセス †HKEY_CURRENT_USER へのアクセスは管理者権限が要りません。 Windows 7 VHD 利用するラップクラス †System.Runtime.Serialization.Jsonの参照 †名前は、System.Runtime.Serialization.JSON.DataContractJsonSerializerなのに、System.Runtime.Serialization.JSONパッケージに入っていない。 Byte[]型のテキストデータをStringとして読み出す †Stream sr = new MemoryStream(byteData); StreamReader sss = new StreamReader(sr); string result = sss.ReadToEnd(); INotifyPropertyChangedの実装 †よりいいINotifyPropertyChangedインターフェイスの実装 public event PropertyChangedEventHandler PropertyChanged; protected void ValidateProperty(string memberName, object value) { if (!string.IsNullOrEmpty(memberName) && value != null) { if (value is string) value = value.ToString().Trim(); Validator.ValidateProperty(value, new ValidationContext(this, null, null) { MemberName = memberName }); } } protected void RaisePropertyChanged(string propertyName) { if ((this.PropertyChanged != null)) { PropertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); } } DataRowを列挙する †並列処理でDataTableの行を列挙する例 Parallel.ForEach<DataRow>(dt.rows.Cast<DataRow>(), de=> { //何かの処理 }); 超多機能のアクセス解析が永久無料! コメント:
|