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


C# CSharpCodeProvider.GetTypeOutput方法代码示例

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


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

示例1: FriendlyName

		public static string FriendlyName(Type type)
		{
			using (var provider = new CSharpCodeProvider())
			{
				var typeRef = new CodeTypeReference(type);
				return provider.GetTypeOutput(typeRef);
			}
		}
开发者ID:matteomigliore,项目名称:HSDK,代码行数:8,代码来源:TypeNameHelper.cs

示例2: ToReadableString

 public static string ToReadableString(this Type type)
 {
     using (var provider = new CSharpCodeProvider())
     {
         var typeRef = new CodeTypeReference(type);
         return provider.GetTypeOutput(typeRef);
     }
 }
开发者ID:vetterd,项目名称:CSBuild,代码行数:8,代码来源:TypeExtension.cs

示例3: GetSimpleName

 public static string GetSimpleName(this Type type)
 {
     var compiler = new CSharpCodeProvider();
     var result = compiler.GetTypeOutput(new CodeTypeReference(type));
     result = Regex.Replace(result, @"[_A-Za-z0-9]+\.", "");
     result = Regex.Replace(result, @"Nullable<(.+?)>", @"$1?");
     return result;
 }
开发者ID:devigned,项目名称:autorest,代码行数:8,代码来源:TypeExtensions.cs

示例4: GetFriendlyTypeName

        public static string GetFriendlyTypeName(Type type)
        {
            using (var p = new CSharpCodeProvider())
            {

                var r = new CodeTypeReference(type, CodeTypeReferenceOptions.GenericTypeParameter);

                return p.GetTypeOutput(r);
            }
        }
开发者ID:nugarin,项目名称:sotsos,代码行数:10,代码来源:ManagedCodeHelper.cs

示例5: GetCSharpTypeName

        /// <summary>
        /// Returns C# alias for specified <paramref name="type"/> for build-in types.
        /// </summary>
        public static string GetCSharpTypeName(Type type)
        {
            Contract.Requires(type != null, "type should not be null.");
            Contract.Ensures(Contract.Result<string>() != null);

            using (var provider = new CSharpCodeProvider())
            {
                var typeRef = new CodeTypeReference(type);
                return provider.GetTypeOutput(typeRef);
            }
        }
开发者ID:SergeyTeplyakov,项目名称:VerificationFakes,代码行数:14,代码来源:TypeNameConverter.cs

示例6: GetCsTypeName

        public static string GetCsTypeName(this Type type)
        {
            string result;
            using (var provider = new CSharpCodeProvider())
            {
                var typeRef = new CodeTypeReference(type);
                result = provider.GetTypeOutput(typeRef);
            }

            if (result.StartsWith("System.Nullable<") && result.EndsWith(">"))
                result = result.Substring(16, result.Length - 17) + "?";
            var dotIndex = result.IndexOf('.');
            if (dotIndex > 0)
                result = result.Substring(dotIndex + 1);

            return result;
        }
开发者ID:seriousseruy,项目名称:UCollections,代码行数:17,代码来源:TypeExtensions.cs

示例7: GetTypeName

 private string GetTypeName(Type type)
 {
     string typeName;
     using (var provider = new CSharpCodeProvider())
     {
         var typeRef = new CodeTypeReference(type);
         typeName = provider.GetTypeOutput(typeRef);
     }
     return typeName;
 }
开发者ID:arashadm,项目名称:Query-Extensions_Win_Xamarin,代码行数:10,代码来源:ParametersCodeGenerator.cs

示例8: ModifyCodeTypeReference

 private static CodeTypeReference ModifyCodeTypeReference(CodeTypeReference typeReference, string modifier)
 {
     using (var provider = new CSharpCodeProvider())
         return new CodeTypeReference(modifier + " " + provider.GetTypeOutput(typeReference));
 }
开发者ID:Particular,项目名称:ServiceControl.Plugin.Nsb6.CustomChecks,代码行数:5,代码来源:PublicApiGenerator.cs

示例9: FormatTypeReference

        private string FormatTypeReference(Type type)
        {
            using (var provider = new CSharpCodeProvider())
            {
                var typeRef = new CodeTypeReference(type);
                var typeName = provider.GetTypeOutput(typeRef);

                typeName = typeName.Substring(typeName.LastIndexOf('.') + 1);
                return typeName;
            }
        }
开发者ID:jacksoncougar,项目名称:Moonfish-Editor,代码行数:11,代码来源:GuerillaToEnt.cs

示例10: GetSpecialName

 private static string GetSpecialName([NotNull] Type type)
 {
     var compiler = new CSharpCodeProvider();
     var typeRef = new CodeTypeReference(type);
     return compiler.GetTypeOutput(typeRef);
 }
开发者ID:JetBrains,项目名称:resharper-unity,代码行数:6,代码来源:TypeResolver.cs


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