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


C# Class.FileWithShortestName方法代码示例

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


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

示例1: GenerateNotifyChanged

	public void GenerateNotifyChanged(Class @class, List<Field> fields)
    {
		var generationMode = GetGenerationModeForClass(fields);
		if (!GenerateForNotifyProperty(generationMode))
			return;
		
		if (GetNotifyChangedGenerationSkipForClass(fields))
	        return;

		var fileName = @class.FileWithShortestName();
		var projectItem = Parser.GetProjectItem(fileName);
		var outputFileName = fileName.Replace(".cs", ".PropertyEvents.g.cs");
		
		GenerateHeader();
		GenerateUsings(@class, new List<string> { "System", "System.ComponentModel", @class.Namespace.Name});

        
        #line default
        #line hidden
        
        #line 357 "E:\Development\Crossbase\CrossBase.CodeGeneration\Templates\EventPropertyTemplate.tt"
this.Write("\r\nnamespace ");

        
        #line default
        #line hidden
        
        #line 359 "E:\Development\Crossbase\CrossBase.CodeGeneration\Templates\EventPropertyTemplate.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(@class.Namespace.Name));

        
        #line default
        #line hidden
        
        #line 359 "E:\Development\Crossbase\CrossBase.CodeGeneration\Templates\EventPropertyTemplate.tt"
this.Write("\t\r\n{\r\n    public partial class ");

        
        #line default
        #line hidden
        
        #line 361 "E:\Development\Crossbase\CrossBase.CodeGeneration\Templates\EventPropertyTemplate.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(@class.Name));

        
        #line default
        #line hidden
        
        #line 361 "E:\Development\Crossbase\CrossBase.CodeGeneration\Templates\EventPropertyTemplate.tt"
this.Write(@"
    {
		public event PropertyChangedEventHandler PropertyChanged;

		protected virtual void NotifyPropertyChanged(String info)
		{
			if (PropertyChanged != null)
			{
				PropertyChanged(this, new PropertyChangedEventArgs(info));
			}
		}
	}
}

");

        
        #line default
        #line hidden
        
        #line 375 "E:\Development\Crossbase\CrossBase.CodeGeneration\Templates\EventPropertyTemplate.tt"

		GenerateFooter();
		debugOutput += string.Format("Generated {0}\r\n", outputFileName);
		Delete(projectItem, outputFileName);
		Save(projectItem, outputFileName);
	}
开发者ID:Gemkin,项目名称:CrossBase,代码行数:76,代码来源:EventPropertyTemplate.cs

示例2: GenerateNotifyChangedInterface

	public void GenerateNotifyChangedInterface(Class @class, List<Field> fields)
    {
		var generationMode = GetGenerationModeForClass(fields);
		if (!GenerateForNotifyProperty(generationMode))
			return;
		var fileName = @class.FileWithShortestName();
		var projectItem = Parser.GetProjectItem(fileName);
		var outputFileName = fileName.Replace(".cs", ".EventPropertyInterface.g.cs");
		
		GenerateHeader();
		GenerateUsings(@class, new List<string> { "System", "System.ComponentModel", @class.Namespace.Name});

        
        #line default
        #line hidden
        
        #line 311 "E:\Development\Crossbase\CrossBase.CodeGeneration\Templates\EventPropertyTemplate.tt"
this.Write("\r\nnamespace ");

        
        #line default
        #line hidden
        
        #line 313 "E:\Development\Crossbase\CrossBase.CodeGeneration\Templates\EventPropertyTemplate.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(@class.Namespace.Name));

        
        #line default
        #line hidden
        
        #line 313 "E:\Development\Crossbase\CrossBase.CodeGeneration\Templates\EventPropertyTemplate.tt"
this.Write("\t\r\n{\r\n    public interface I");

        
        #line default
        #line hidden
        
        #line 315 "E:\Development\Crossbase\CrossBase.CodeGeneration\Templates\EventPropertyTemplate.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(@class.Name));

        
        #line default
        #line hidden
        
        #line 315 "E:\Development\Crossbase\CrossBase.CodeGeneration\Templates\EventPropertyTemplate.tt"
this.Write("EventProperties\r\n    {\r\n\t\tevent PropertyChangedEventHandler PropertyChanged;\r\n");

        
        #line default
        #line hidden
        
        #line 318 "E:\Development\Crossbase\CrossBase.CodeGeneration\Templates\EventPropertyTemplate.tt"

	    foreach (var field in fields)
	    {
	        var propertyName = field.GetDefaultPublicPropertyName();
			var propertyType = field.Type;

        
        #line default
        #line hidden
        
        #line 323 "E:\Development\Crossbase\CrossBase.CodeGeneration\Templates\EventPropertyTemplate.tt"
this.Write("\t\t\t");

        
        #line default
        #line hidden
        
        #line 324 "E:\Development\Crossbase\CrossBase.CodeGeneration\Templates\EventPropertyTemplate.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(propertyType));

        
        #line default
        #line hidden
        
        #line 324 "E:\Development\Crossbase\CrossBase.CodeGeneration\Templates\EventPropertyTemplate.tt"
this.Write(" ");

        
        #line default
        #line hidden
        
        #line 324 "E:\Development\Crossbase\CrossBase.CodeGeneration\Templates\EventPropertyTemplate.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(propertyName));

        
        #line default
        #line hidden
        
        #line 324 "E:\Development\Crossbase\CrossBase.CodeGeneration\Templates\EventPropertyTemplate.tt"
this.Write(" { get;set; }\r\n\r\n");

        
        #line default
        #line hidden
        
        #line 326 "E:\Development\Crossbase\CrossBase.CodeGeneration\Templates\EventPropertyTemplate.tt"


//.........这里部分代码省略.........
开发者ID:Gemkin,项目名称:CrossBase,代码行数:101,代码来源:EventPropertyTemplate.cs


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