読者です 読者をやめる 読者になる 読者になる

ちなみにC#版

using System;
using System.Collections.Generic;
using System.Collections;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Hashtable hash = new Hashtable();
            hash.Add("key1", 1);

            PrintHash(hash, "\r\nhash before hoge.");
            hoge(hash);
            PrintHash(hash, "hash after hoge.");

            PrintHash(hash, "\r\nhash before hoge2.");
            hoge2(hash);
            PrintHash(hash, "hash after hoge2.");

            PrintHash(hash, "\r\nhash before hoge3.");
            hoge3(ref hash);
            PrintHash(hash, "hash after hoge3.");
        }

        static private void hoge(Hashtable arg)
        {
            arg.Add("key2", 2);
            PrintHash(arg, "hash in hoge.");
        }

        static private void hoge2(Hashtable arg)
        {
            arg = new Hashtable();
            arg.Add("key100000", 100000);
            PrintHash(arg, "hash in hoge2.");
        }

        static private void hoge3(ref Hashtable arg)
        {
            arg = new Hashtable();
            arg.Add("key100000", 100000);
            PrintHash(arg, "hash in hoge3.");
        }

        static private void PrintHash(Hashtable hash, string comment)
        {
            Console.WriteLine(comment);
            foreach (string key in hash.Keys)
                Console.WriteLine("  \"{0}\" => {1}", key, hash[key]);
        }
    }
}

結果

hash before hoge.
  "key1" => 1
hash in hoge.
  "key2" => 2
  "key1" => 1
hash after hoge.
  "key2" => 2
  "key1" => 1

hash before hoge2.
  "key2" => 2
  "key1" => 1
hash in hoge2.
  "key100000" => 100000
hash after hoge2.
  "key2" => 2
  "key1" => 1

hash before hoge3.
  "key2" => 2
  "key1" => 1
hash in hoge3.
  "key100000" => 100000
hash after hoge3.
  "key100000" => 100000

C#ではrefキーワードがあって、こいつをつけると参照として引数を渡す事が出来る。