您的“方法”与我的方法有关:
void myMethod(int param1, int param2) { }
并且你想制造一种代表签名方法的插图:
string myString = "myMethod (int, int)";
通过方法学信息参数,我得以通过使用参数类型确定这些结果:
"myMethod (System.Int32, System.Int32)"
我如何能够改进这项工作并产生上述成果?
您的“方法”与我的方法有关:
void myMethod(int param1, int param2) { }
并且你想制造一种代表签名方法的插图:
string myString = "myMethod (int, int)";
通过方法学信息参数,我得以通过使用参数类型确定这些结果:
"myMethod (System.Int32, System.Int32)"
我如何能够改进这项工作并产生上述成果?
这个问题以前已经提出过,可以通过《刑法》复制件来完成。 见,和。 请注意,这些关键词(int, bool,等)是具体语言,因此,如果你为一般语文编写。 该网络的消费者通常倾向于使用框架协议类型名称。
As far as I know, there is nothing built-in that will convert the real type name of a primitive (System.Int32
) to the built-in alias (int
). Since there is only a very small number of these aliases, it s not too difficult to write your own method:
public static string GetTypeName(Type type)
{
if (type == typeof(int)) // Or "type == typeof(System.Int32)" -- same either way
return "int";
else if (type == typeof(long))
return "long";
...
else
return type.Name; // Or "type.FullName" -- not sure if you want the namespace
}
That being said, if the user actually did type in System.Int32
rather than int
(which of course would be perfectly legal) this technique would still print out "int". There s not a whole lot you can do about that because the System.Type
is the same either way -- so there s no way for you to find out which variant the user actually typed.
What is the use of default keyword in C#? Is it introduced in C# 3.0 ?
I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...
I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...
I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...
I have two EF entities. One has a property called HouseNumber. The other has two properties, one called StartHouseNumber and one called EndHouseNumber. I want to create a many to many association ...
How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...
Since I cannot order my dictionary, what is the best way of going about taking key value pairs and also maintaing an index?
Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...