本文整理汇总了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);
}
示例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"
//.........这里部分代码省略.........