471,570 Members | 1,680 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,570 software developers and data experts.

c# names for FCL Types

Hello Everyone!

do you people know of any function in the framework to translate FCL
Type names of primitives to c# type names?. i.e. CSharp.GetName(
Type type )

CSharp.GetName( typeof(System.Int32)) == "int"
CSharp.GetName( typeof(System.Void)) == "void"
Thanks,

Lennin

Feb 9 '06 #1
2 1703
> do you people know of any function in the framework to translate FCL
Type names of primitives to c# type names?.


I think you can do it with the C# CodeDom support. But since there are
so few of them it's probably easier to use your own translation table.
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Feb 9 '06 #2
"le****@gmail.com" wrote:
do you people know of any function in the framework to translate FCL
Type names of primitives to c# type names?


Yes.

private static string GetCsTypeName(CodeTypeReference type)
{
if (type == null)
throw new ArgumentNullException("type");
using (CodeDomProvider cs =
CodeDomProvider.CreateProvider("CSharp"))
return cs.GetTypeOutput(type);
}

Mark
Feb 12 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

22 posts views Thread by BRIAN VICKERY | last post: by
1 post views Thread by Jens Riedel | last post: by
15 posts views Thread by Thomas Scheiderich | last post: by
16 posts views Thread by per9000 | last post: by
4 posts views Thread by Victor Lagerkvist | last post: by
23 posts views Thread by mike3 | last post: by
23 posts views Thread by MikeB | last post: by
3 posts views Thread by SRoubtsov | last post: by
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by lumer26 | last post: by
reply views Thread by Vinnie | last post: by
reply views Thread by lumer26 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.