1
A
回答
4
試試這個:如果您需要了解所有的參數太多,嘗試像
private static void Main()
{
MethodInfo[] methodInfos = typeof(Math).GetMethods(BindingFlags.Public | BindingFlags.Static);
foreach (MethodInfo methodInfo in methodInfos)
{
Console.WriteLine(String.Format("{0} with following parameters", methodInfo.Name));
ParameterInfo[] parameters = methodInfo.GetParameters();
foreach (ParameterInfo parameter in parameters)
{
Console.WriteLine("Name : {0}, Type : {1}", parameter.Name, parameter.ParameterType.FullName);
}
Console.WriteLine("--------------");
}
}
的
MethodInfo[] methodInfos = typeof(Math).GetMethods(BindingFlags.Public | BindingFlags.Static);
foreach (MethodInfo methodInfo in methodInfos)
{
Console.WriteLine(methodInfo.Name);
}
Addtionally輸出:
Acos with following parameters
Name : d, Type : System.Double
--------------
Asin with following parameters
Name : d, Type : System.Double
--------------
Atan with following parameters
Name : d, Type : System.Double
--------------
Atan2 with following parameters
Name : y, Type : System.Double
Name : x, Type : System.Double
--------------
Ceiling with following parameters
Name : d, Type : System.Decimal
--------------
Ceiling with following parameters
Name : a, Type : System.Double
--------------
Cos with following parameters
Name : d, Type : System.Double
--------------
Cosh with following parameters
Name : value, Type : System.Double
--------------
Floor with following parameters
Name : d, Type : System.Decimal
--------------
Floor with following parameters
Name : d, Type : System.Double
--------------
Sin with following parameters
Name : a, Type : System.Double
--------------
Tan with following parameters
Name : a, Type : System.Double
--------------
Sinh with following parameters
Name : value, Type : System.Double
--------------
Tanh with following parameters
Name : value, Type : System.Double
--------------
Round with following parameters
Name : a, Type : System.Double
--------------
Round with following parameters
Name : value, Type : System.Double
Name : digits, Type : System.Int32
--------------
Round with following parameters
Name : value, Type : System.Double
Name : mode, Type : System.MidpointRounding
--------------
Round with following parameters
Name : value, Type : System.Double
Name : digits, Type : System.Int32
Name : mode, Type : System.MidpointRounding
--------------
Round with following parameters
Name : d, Type : System.Decimal
--------------
Round with following parameters
Name : d, Type : System.Decimal
Name : decimals, Type : System.Int32
--------------
Round with following parameters
Name : d, Type : System.Decimal
Name : mode, Type : System.MidpointRounding
--------------
Round with following parameters
Name : d, Type : System.Decimal
Name : decimals, Type : System.Int32
Name : mode, Type : System.MidpointRounding
--------------
Truncate with following parameters
Name : d, Type : System.Decimal
--------------
Truncate with following parameters
Name : d, Type : System.Double
--------------
Sqrt with following parameters
Name : d, Type : System.Double
--------------
Log with following parameters
Name : d, Type : System.Double
--------------
Log10 with following parameters
Name : d, Type : System.Double
--------------
Exp with following parameters
Name : d, Type : System.Double
--------------
Pow with following parameters
Name : x, Type : System.Double
Name : y, Type : System.Double
--------------
IEEERemainder with following parameters
Name : x, Type : System.Double
Name : y, Type : System.Double
--------------
Abs with following parameters
Name : value, Type : System.SByte
--------------
Abs with following parameters
Name : value, Type : System.Int16
--------------
Abs with following parameters
Name : value, Type : System.Int32
--------------
Abs with following parameters
Name : value, Type : System.Int64
--------------
Abs with following parameters
Name : value, Type : System.Single
--------------
Abs with following parameters
Name : value, Type : System.Double
--------------
Abs with following parameters
Name : value, Type : System.Decimal
--------------
Max with following parameters
Name : val1, Type : System.SByte
Name : val2, Type : System.SByte
--------------
Max with following parameters
Name : val1, Type : System.Byte
Name : val2, Type : System.Byte
--------------
Max with following parameters
Name : val1, Type : System.Int16
Name : val2, Type : System.Int16
--------------
Max with following parameters
Name : val1, Type : System.UInt16
Name : val2, Type : System.UInt16
--------------
Max with following parameters
Name : val1, Type : System.Int32
Name : val2, Type : System.Int32
--------------
Max with following parameters
Name : val1, Type : System.UInt32
Name : val2, Type : System.UInt32
--------------
Max with following parameters
Name : val1, Type : System.Int64
Name : val2, Type : System.Int64
--------------
Max with following parameters
Name : val1, Type : System.UInt64
Name : val2, Type : System.UInt64
--------------
Max with following parameters
Name : val1, Type : System.Single
Name : val2, Type : System.Single
--------------
Max with following parameters
Name : val1, Type : System.Double
Name : val2, Type : System.Double
--------------
Max with following parameters
Name : val1, Type : System.Decimal
Name : val2, Type : System.Decimal
--------------
Min with following parameters
Name : val1, Type : System.SByte
Name : val2, Type : System.SByte
--------------
Min with following parameters
Name : val1, Type : System.Byte
Name : val2, Type : System.Byte
--------------
Min with following parameters
Name : val1, Type : System.Int16
Name : val2, Type : System.Int16
--------------
Min with following parameters
Name : val1, Type : System.UInt16
Name : val2, Type : System.UInt16
--------------
Min with following parameters
Name : val1, Type : System.Int32
Name : val2, Type : System.Int32
--------------
Min with following parameters
Name : val1, Type : System.UInt32
Name : val2, Type : System.UInt32
--------------
Min with following parameters
Name : val1, Type : System.Int64
Name : val2, Type : System.Int64
--------------
Min with following parameters
Name : val1, Type : System.UInt64
Name : val2, Type : System.UInt64
--------------
Min with following parameters
Name : val1, Type : System.Single
Name : val2, Type : System.Single
--------------
Min with following parameters
Name : val1, Type : System.Double
Name : val2, Type : System.Double
--------------
Min with following parameters
Name : val1, Type : System.Decimal
Name : val2, Type : System.Decimal
--------------
Log with following parameters
Name : a, Type : System.Double
Name : newBase, Type : System.Double
--------------
Sign with following parameters
Name : value, Type : System.SByte
--------------
Sign with following parameters
Name : value, Type : System.Int16
--------------
Sign with following parameters
Name : value, Type : System.Int32
--------------
Sign with following parameters
Name : value, Type : System.Int64
--------------
Sign with following parameters
Name : value, Type : System.Single
--------------
Sign with following parameters
Name : value, Type : System.Double
--------------
Sign with following parameters
Name : value, Type : System.Decimal
--------------
BigMul with following parameters
Name : a, Type : System.Int32
Name : b, Type : System.Int32
--------------
DivRem with following parameters
Name : a, Type : System.Int32
Name : b, Type : System.Int32
Name : result, Type : System.Int32&
--------------
DivRem with following parameters
Name : a, Type : System.Int64
Name : b, Type : System.Int64
Name : result, Type : System.Int64&
--------------
+0
作品。將在5分鐘內標記爲答案 – 2013-02-23 06:47:59
0
var list = typeof(Math).GetMembers().Select(c => c.Name).Distinct().ToList();
+0
不錯,但是這個返回成員包括(屬性,方法,字段,事件等等)。 – 2013-02-23 08:46:43
+0
@Mahdi我們可以在一行中做到這一點':)' – spajce 2013-02-23 08:51:01
相關問題
- 1. 在靜態方法中獲取運行時的當前類?
- 2. 如何在靜態方法中獲取當前類的名稱?
- 3. 如何在PHP中使用靜態方法獲取類名?
- 4. 如何從Python中的靜態方法獲取(子)類名?
- 5. 如何獲取調用靜態方法的類和方法?
- 6. 如何在運行時更改靜態方法的行爲?
- 7. 類名的靜態方法?
- 8. php:在靜態方法中獲取繼承類的名稱
- 9. 如何獲取類在.NET中輸入基類靜態方法?
- 10. 如何在運行時獲取類名,但只有類名?
- 11. 在運行時獲取類和方法名稱
- 12. 如何獲取PowerShell靜態類方法中的當前類名/對象?
- 13. AS3從靜態方法獲取當前類名
- 14. 如何在php中靜態獲取類的名稱?
- 15. 如何在運行時獲取參數的名稱類型?
- 16. 如何在運行時(動態)創建PHP靜態類屬性?
- 17. 從一個普通的靜態方法獲取類的名字在Java中
- 18. 只能使用獲得的靜態類型在運行時
- 19. 如何在duktape中運行構造函數時獲取類名?
- 20. 在ActionScript3中運行時,有沒有辦法從類中獲取所有靜態成員的名單
- 21. 靜態類中的匿名方法是非靜態的?如何調用它?
- 22. QtConcurrent ::重載的靜態方法運行
- 23. 在類c中的靜態方法中獲取標籤#
- 24. 在運行時獲取目標類的所有方法
- 25. 如何在靜態方法中獲取會話變量的值?
- 26. 如何在運行時獲取方法的JavaDoc?
- 27. 如何調用類的靜態方法?
- 28. nuSOAP靜態類方法命名
- 29. 從JavascriptMVC中的靜態方法獲取靜態屬性的值
- 30. 如何從靜態的靜態類/方法傳遞數據?
您是否嘗試過與此System.Reflection.MethodInfo.GetCurrentMethod(); – coder 2013-02-23 06:44:22
@coder我不想要當前的方法。我想要所有存在於類Math中的方法 – 2013-02-23 06:45:00
你想在運行時還是設計時使用它? – 2013-02-23 06:45:07