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


C# CodeDomProvider.CreateEscapedIdentifier方法代码示例

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


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

示例1: EscapeKeywords

 private static void EscapeKeywords(string identifier, CodeDomProvider codeProvider, StringBuilder sb)
 {
     if ((identifier != null) && (identifier.Length != 0))
     {
         int num = 0;
         while (identifier.EndsWith("[]", StringComparison.Ordinal))
         {
             num++;
             identifier = identifier.Substring(0, identifier.Length - 2);
         }
         if (identifier.Length > 0)
         {
             CheckValidIdentifier(identifier);
             identifier = codeProvider.CreateEscapedIdentifier(identifier);
             sb.Append(identifier);
         }
         for (int i = 0; i < num; i++)
         {
             sb.Append("[]");
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:22,代码来源:CodeIdentifier.cs

示例2: GenerateAction

		static void GenerateAction (CodeTypeReference exportAtt, CodeTypeDeclaration type, IBAction action, 
			CodeDomProvider provider, CodeGeneratorOptions generatorOptions)
		{
			if (provider is Microsoft.CSharp.CSharpCodeProvider) {
				type.Members.Add (new CodeSnippetTypeMember ("[" + exportAtt.BaseType + "(\"" + action.GetObjcFullName ()  + "\")]"));
				
				var sb = new System.Text.StringBuilder ();
				sb.Append ("partial void ");
				sb.Append (provider.CreateEscapedIdentifier (action.CliName));
				sb.Append (" (");
				if (action.Parameters != null) {
					bool isFirst = true;
					foreach (var p in action.Parameters) {
						if (!isFirst) {
							sb.Append (", ");
						} else {
							isFirst = false;
						}
						sb.Append (p.CliType);
						sb.Append (" ");
						sb.Append (provider.CreateEscapedIdentifier (p.Name));
					}
				}
				sb.Append (");");
				
				type.Members.Add (new CodeSnippetTypeMember (sb.ToString ()));
				return;
			}
			
			var m = CreateEventMethod (exportAtt, action);
			type.Members.Add (m);
			
			if (provider.FileExtension == "pas") {
				m.UserData ["OxygenePartial"] = "YES";
				m.UserData ["OxygeneEmpty"] = "YES";
			}
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:37,代码来源:NSObjectInfo.cs

示例3: SanitizeResourceName

		string SanitizeResourceName (CodeDomProvider provider, string name)
		{
			if (provider.IsValidIdentifier (name))
				return provider.CreateEscapedIdentifier (name);

			var sb = new StringBuilder ();
			char ch = name [0];
			if (is_identifier_start_character (ch))
				sb.Append (ch);
			else {
				sb.Append ('_');
				if (ch >= '0' && ch <= '9')
					sb.Append (ch);
			}
			
			for (int i = 1; i < name.Length; i++) {
				ch = name [i];
				if (is_identifier_part_character (ch))
					sb.Append (ch);
				else
					sb.Append ('_');
			}
			
			return provider.CreateEscapedIdentifier (sb.ToString ());
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:25,代码来源:AppResourcesCompiler.cs


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