.NET Framework には膨大な数のクラスライブラリが用意されています。その中で多く使われているメソッド名(動詞)は何なのでしょうか。メソッド名をつける際の参考になると思い調査してみました。結果は次のとおりです。

メソッド名 使用数 メソッド名 使用数 メソッド名 使用数
Get 2903 Hide 5 Bring 1
Add 603 Instantiate 5 Byte 1
Begin 531 Lock 5 Bytes 1
End 528 Modify 5 Calculate 1
Remove 512 Navigate 5 Ceiling 1
Set 473 Operation 5 Choose 1
To 467 Paginate 5 Clean 1
Invoke 434 Play 5 Code 1
Create 411 Post 5 Collect 1
Copy 405 Prepend 5 Collection 1
Is 393 Ptr 5 Committed 1
Write 271 Quote 5 Complement 1
Contains 266 Report 5 Compress 1
Clear 227 Role 5 Concat 1
Index 210 Secure 5 Confirm 1
Equals 206 Unquote 5 Connection 1
Reset 182 Zero 5 Constrained 1
Read 173 Call 4 Continue 1
Insert 161 Capture 4 Cos 1
Convert 152 Combine 4 Cosh 1
Initialize 148 Crypt 4 Counter 1
Find 132 Emit 4 Custom 1
Clone 131 Escape 4 Date 1
Draw 126 Include 4 Deactivate 1
Can 124 Item 4 Decimal 1
Render 119 Join 4 Declare 1
Dispose 116 Matches 4 Decompress 1
On 94 Needs 4 Def 1
From 90 Paste 4 Dependent 1
Load 89 Reflection 4 Directory 1
Close 87 Restore 4 Display 1
Move 83 Reverse 4 Div 1
Delete 67 Skip 4 Done 1
Parse 64 Soap 4 Downgrade 1
Register 54 Undo 4 Drop 1
Generate 53 Unload 4 Duplicate 1
Save 47 Activate 3 Dynamic 1
Append 46 As 3 E 1
Open 46 Attach 3 Early 1
Select 45 Chain 3 Element 1
Validate 45 Complete 3 Ends 1
Flush 44 Dangerous 3 Equal 1
Resolve 42 Decrement 3 Equality 1
Define 39 Demand 3 Equivalent 1
Edit 37 Deselect 3 Erase 1
Send 36 Discard 3 Exchange 1
Check 35 Disconnect 3 Exp 1
Intersect 35 Discover 3 Fast 1
Update 35 Dispatch 3 File 1
Union 34 Double 3 Filename 1
Import 33 Down 3 Final 1
Make 32 Exec 3 Fixed 1
Process 28 Group 3 Flatten 1
Execute 27 Impersonate 3 Floor 1
Serialize 27 Infer 3 Forget 1
Start 27 Int 3 Forward 1
Show 26 Key 3 Function 1
Apply 25 Layout 3 Global 1
Change 25 Mark 3 Hash 1
Has 25 Max 3 Have 1
Stop 25 Normalize 3 Headers 1
Verify 25 Notify 3 Host 1
Refresh 24 Persist 3 In 1
Init 22 Point 3 Initiate 1
Cancel 21 Populate 3 Instance 1
Should 21 Position 3 Intern 1
Transform 21 Print 3 Internal 1
Data 20 Protect 3 Interrupt 1
Allow 19 Re 3 Invert 1
Compare 19 Record 3 Items 1
Decrypt 19 Reflect 3 Keep 1
Export 19 Reject 3 Late 1
Paint 19 Retrieve 3 Launch 1
Release 19 Search 3 Listen 1
Exit 18 Split 3 Localize 1
Trace 18 Throw 3 Login 1
Install 17 Toggle 3 Logout 1
Merge 17 Transfer 3 Maintain 1
Deserialize 16 Trigger 3 Marshal 1
Enter 16 Un 3 Memory 1
Sync 16 Unprotect 3 Min 1
Uninstall 16 Unsupported 3 Navigators 1
Commit 15 Up 3 Nearest 1
Encrypt 15 Upgrade 3 Network 1
Next 15 Value 3 Not 1
Seek 15 Abandon 2 Num 1
Fill 14 Acquire 2 Object 1
Focus 14 Adorner 2 Offset 1
Handle 14 Alloc 2 Ole 1
Prepare 14 Atan 2 Or 1
Rollback 14 Auth 2 Outer 1
Abort 13 Compose 2 Override 1
Async 13 Control 2 Pack 1
Perform 13 Cut 2 Pause 1
Raise 13 Dark 2 Pending 1
Replace 13 Decompose 2 Pics 1
Translate 13 Deny 2 Policy 1
Do 12 Dequeue 2 Poll 1
Enlist 12 Designer 2 Pow 1
Format 12 Destroy 2 Precompile 1
Lookup 12 Displayed 2 Prepared 1
Peek 12 Doc 2 Preprocess 1
Try 12 Editing 2 Present 1
Url 12 Enqueue 2 Preserve 1
Compile 11 Enum 2 Probe 1
Download 11 Enumerate 2 Prompt 1
Extract 11 Eval 2 Protected 1
Sort 11 Exclude 2 Publish 1
Synchronized 11 Filter 2 Query 1
Unregister 11 Fire 2 Queue 1
Wait 11 For 2 Recover 1
Determine 10 Freeze 2 Redo 1
Ensure 10 Gac 2 Redraw 1
Invalidate 10 Header 2 Reenlist 1
Map 10 Hex 2 Relational 1
Shutdown 10 Hint 2 Reload 1
Trim 10 I 2 Rename 1
Access 9 Indent 2 Renders 1
Audit 9 Info 2 Renew 1
Auto 9 Kill 2 Renewal 1
Bind 9 Lang 2 Reorder 1
Build 9 Leave 2 Repeat 1
Evaluate 9 Light 2 Reprocess 1
Expand 9 Logical 2 Request 1
Push 9 Logo 2 Require 1
Configure 8 Main 2 Requires 1
Encode 8 New 2 Restart 1
Exists 8 Number 2 Result 1
Free 8 Pad 2 Revoke 1
Html 8 Permit 2 Rewind 1
Pop 8 Prefetch 2 Rewrite 1
Pre 8 Prelink 2 Screen 1
Purge 8 Property 2 Serialization 1
Receive 8 Provide 2 Server 1
Resume 8 Pulse 2 Service 1
Revert 8 Put 2 Shared 1
Rotate 8 Recovery 2 Shear 1
Run 8 Rectangle 2 Signal 1
Sign 8 Reference 2 Sin 1
String 8 Remoting 2 Single 1
Upload 8 Repair 2 Sinh 1
Collapse 7 Resize 2 Size 1
Decode 7 Root 2 Sleep 1
Hit 7 Round 2 Source 1
Measure 7 Schemas 2 Spin 1
Scale 7 Seize 2 Sqrt 1
Supports 7 Starts 2 Structure 1
Unlock 7 Store 2 Sub 1
Unsafe 7 Test 2 Swap 1
Accept 6 Type 2 Switch 1
Authenticate 6 Unescape 2 Synchronous 1
Compute 6 Unindent 2 System 1
Connect 6 Volatile 2 Takes 1
Detach 6 Xor 2 Tan 1
Enable 6 TRUE 2 Tanh 1
Fail 6 Aborted 1 Text 1
Fallback 6 Abs 1 Ticket 1
Increment 6 Acos 1 Time 1
Last 6 Adapter 1 Transmit 1
Log 6 After 1 Truncate 1
M 6 Alert 1 Unbind 1
Match 6 And 1 Unbox 1
Multiply 6 Animate 1 Unmarshal 1
Redirect 6 Any 1 Unpack 1
Scroll 6 Are 1 Unwrap 1
Substring 6 Arrange 1 Use 1
Suppress 6 Asin 1 Using 1
Suspend 6 Assign 1 Valid 1
Adjust 5 Asynchronous 1 Vary 1
Allocate 5 Attribute 1 Vector 1
Assert 5 Back 1 View 1
Binary 5 Base 1 Warn 1
Debug 5 Beep 1 Warp 1
Derive 5 Big 1 Widen 1
Device 5 Block 1 Wrap 1
Disable 5 Boolean 1 Xml 1
Force 5 Box 1 Xslt 1
Go 5 Break 1

 メソッドの種類が 533 と予想以上に多いのが驚きですが、最も多く使われているメソッドは「Get」のようです。取得する処理が頻繁にあるということですね。あとこれに日本語訳があればいいのですが、というよりそれが無いとあまり参考にならないので時間があるときにでも追加したいと思います。

 今回調査した結果は、公開されている全てのクラスの公開されている全てのメソッド(Protected を含む)を対象にしました。アセンブリは System と名の付くものを全て含めています(やりすぎたかもしれません)。メソッドは先頭の単語のみ(Pascal 形式)を対象としています。このため一文字のメソッド名というおかしな結果もあります。オーバーロードされたメソッドは一つとしてカウントしています。

 そして実際に結果を出力したコードがこれです。参考になるソースを見ながら作成したので、今回は C# です。

メソッドの動詞の数を出力するコード
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
 
namespace AssemblyLoadTest
{
    class Program
    {
        static void Main(string[] args)
        {
            LoadAssemblies();
 
            // メソッド名の動詞の数を出力する 
            WriteMethodNameCount();
        }
 
        private static void LoadAssemblies()
        {
            String[] assemblies ={
                "System,                        PublicKeyToken={0}",
                "System.Data,                   PublicKeyToken={0}",
                "System.Data.OracleClient,      PublicKeyToken={0}",
                "System.Data.SqlXml,            PublicKeyToken={0}",
                "System.Runtime.Remoting,       PublicKeyToken={0}",
                "System.Windows.Forms,          PublicKeyToken={0}",
                "System.Transactions,           PublicKeyToken={0}",
                "System.Xml,                    PublicKeyToken={0}",
                "System.Configuration,          PublicKeyToken={1}",
                "System.Configuration.Install,  PublicKeyToken={1}",
                "System.Deployment,             PublicKeyToken={1}",
                "System.Design,                 PublicKeyToken={1}",
                "System.DirectoryServices,      PublicKeyToken={1}",
                "System.DirectoryServices.Protocols, PublicKeyToken={1}",
                "System.Drawing,                PublicKeyToken={1}",
                "System.Drawing.Design,         PublicKeyToken={1}",
                "System.EnterpriseServices,     PublicKeyToken={1}",
                "System.Management,             PublicKeyToken={1}",
                "System.Messaging,              PublicKeyToken={1}",
                "System.Runtime.Serialization.Formatters.Soap, PublicKeyToken={1}",
                "System.Security,               PublicKeyToken={1}",
                "System.ServiceProcess,         PublicKeyToken={1}",
                "System.Web,                    PublicKeyToken={1}",
                "System.Web.Mobile,             PublicKeyToken={1}",
                "System.Web.RegularExpressions, PublicKeyToken={1}",
                "System.Web.Services,           PublicKeyToken={1}",
            };
 
            String EcmaPublicKeyToken = "b77a5c561934e089";
            String MSPublicKeyToken = "b03f5f7f11d50a3a";
 
            foreach (String a in assemblies)
            {
                String AssemblyIdentity =
                    String.Format(a, EcmaPublicKeyToken, MSPublicKeyToken) +
                    ", Culture=neutral, Version=2.0.0.0"
 
                Assembly.Load(AssemblyIdentity);
            }
        }
 
        /// <summary>
        /// メソッド名の動詞の数を出力する 
        /// </summary>
        private static void WriteMethodNameCount()
        {
            Int32 totalMethods = 0;
            List<String> methodTree = new List<string>();
 
            foreach (Assembly a in AppDomain.CurrentDomain.GetAssemblies())
            {
                foreach (Type t in a.GetExportedTypes())
                {
                    if (!t.IsClass || !t.IsPublic)
                    {
                        continue;
                    }
 
                    const BindingFlags bf =
                        BindingFlags.Public |
                        BindingFlags.Instance | BindingFlags.Static |
                        BindingFlags.DeclaredOnly;
 
                    List<String> typeHierarchy = new List<String>();
 
                    MethodInfo[] methodes = t.GetMethods(bf);
                    List<String> d = new List<String>();
 
                    foreach (MethodInfo m in methodes)
                    {
                        if (!d.Contains(m.Name))
                        {
                            d.Add(m.Name);
                            typeHierarchy.Add(m.Name);
                        }
                    }
 
                    foreach (String s in typeHierarchy)
                    {
                        totalMethods++;
                        methodTree.Add(s);
                    }
                }
            }
 
            methodTree.Sort();
 
            Regex r = new Regex("^[A-Z][a-z]*");
            Dictionary<String, Int32> nameCount = new Dictionary<string, int>();
 
            System.IO.StreamWriter sw = new System.IO.StreamWriter(@"D:\MethodNameCount.txt", false);
            foreach (String s in methodTree)
            {
                Match m = r.Match(s);
                if (m.Success)
                {
                    if (nameCount.ContainsKey(m.Value))
                    {
                        nameCount[m.Value] += 1;
                    }
                    else
                    {
                        nameCount.Add(m.Value, 1);
                    }
                }
            }

            sw.WriteLine("全部で {0} 個のメソッドが存在します。", totalMethods);
            sw.WriteLine("全部で {0} 種類のメソッドが存在します。", nameCount.Count);

            foreach (KeyValuePair<String, Int32> kvp in nameCount)
            {
                sw.WriteLine(String.Format("{0},{1}", kvp.Key, kvp.Value));
            }
 
            sw.Close();
        }
    }
}