当前位置: 首页>>代码示例>>C#>>正文


C# LogSwitch.AddChildSwitch方法代码示例

本文整理汇总了C#中System.Diagnostics.LogSwitch.AddChildSwitch方法的典型用法代码示例。如果您正苦于以下问题:C# LogSwitch.AddChildSwitch方法的具体用法?C# LogSwitch.AddChildSwitch怎么用?C# LogSwitch.AddChildSwitch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Diagnostics.LogSwitch的用法示例。


在下文中一共展示了LogSwitch.AddChildSwitch方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LogSwitch

 	// Constructs a LogSwitch.  A LogSwitch is used to categorize log messages.
 	// 
 	// All switches (except for the global LogSwitch) have a parent LogSwitch.
 	//
 	/// <include file='doc\LogSwitch.uex' path='docs/doc[@for="LogSwitch.LogSwitch"]/*' />
 	public LogSwitch(String name, String description, LogSwitch parent)
 	{
 		if ((name != null) && (parent != null) )
 		{
 			if (name.Length == 0)
 				throw new ArgumentOutOfRangeException (
 				"Name", Environment.GetResourceString(
 					"Namelength_0"));
 				
 			strName = name;
 			strDescription = description;
 			iLevel = LoggingLevels.ErrorLevel;
 			iOldLevel = iLevel;
 
 			// update the parent switch to reflect this child switch
 			parent.AddChildSwitch (this);
 
 			ParentSwitch = parent;
 
 			ChildSwitch  = null;
 			iNumChildren = 0;
 			iChildArraySize = 0;
 
 			Log.m_Hashtable.Add (strName, this);			
 
 			// Call into the EE to let it know about the creation of
 			// this switch
 			Log.AddLogSwitch (this);
 
 			// update switch count
 			Log.iNumOfSwitches++;
 		}
 		else
 			throw new ArgumentNullException ((name==null ? "name" : "parent"));
 	}
开发者ID:ArildF,项目名称:masters,代码行数:40,代码来源:logswitch.cs

示例2: LogSwitch

 public LogSwitch(string name, string description, LogSwitch parent)
 {
     if ((name != null) && (name.Length == 0))
     {
         throw new ArgumentOutOfRangeException("Name", Environment.GetResourceString("Argument_StringZeroLength"));
     }
     if ((name == null) || (parent == null))
     {
         throw new ArgumentNullException((name == null) ? "name" : "parent");
     }
     this.strName = name;
     this.strDescription = description;
     this.iLevel = LoggingLevels.ErrorLevel;
     this.iOldLevel = this.iLevel;
     parent.AddChildSwitch(this);
     this.ParentSwitch = parent;
     this.ChildSwitch = null;
     this.iNumChildren = 0;
     this.iChildArraySize = 0;
     Log.m_Hashtable.Add(this.strName, this);
     Log.AddLogSwitch(this);
     Log.iNumOfSwitches++;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:23,代码来源:LogSwitch.cs


注:本文中的System.Diagnostics.LogSwitch.AddChildSwitch方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。