15,904,823 members
Home / Discussions / C#

# C#

 Re: How to get very continuous random numbers BoneSoft2-Jul-06 16:39 BoneSoft 2-Jul-06 16:39
 Re: How to get very continuous random numbers Paul Conrad2-Jul-06 17:19 Paul Conrad 2-Jul-06 17:19
 Re: How to get very continuous random numbers Judah Gabriel Himango3-Jul-06 5:27 Judah Gabriel Himango 3-Jul-06 5:27
 Re: How to get very continuous random numbers Guffa2-Jul-06 11:48 Guffa 2-Jul-06 11:48
 Re: How to get very continuous random numbers mav.northwind2-Jul-06 23:30 mav.northwind 2-Jul-06 23:30
 Message Removed 2-Jul-06 4:35 Mandai 2-Jul-06 4:35
 Re: Asking a question Ravi Bhavnani2-Jul-06 4:55 Ravi Bhavnani 2-Jul-06 4:55
 Arrays in Hashtables Mazze.ger1-Jul-06 23:17 Mazze.ger 1-Jul-06 23:17
 Hi guys! A quick question from a c# newbie. Please take a look at the following two examples: EXAMPLE 1: using System; using System.Collections; class Tester { public static void Main() { Hashtable x = new Hashtable(); int[] y = { 1, 2, 3 }; x["1"] = y; int[] z = { 4, 5, 6 }; x["2"] = z; Console.WriteLine(((int[])x["1"])[1]); Console.WriteLine(((int[])x["2"])[1]); System.Threading.Thread.Sleep(25000); } } EXAMPLE 2: using System; using System.Collections; class Tester { public static void Main() { Hashtable x = new Hashtable(); int[] y = { 1, 2, 3 }; x["1"] = y; y[0] = 4; y[1] = 5; y[2] = 6; x["2"] = y; Console.WriteLine(((int[])x["1"])[1]); Console.WriteLine(((int[])x["2"])[1]); System.Threading.Thread.Sleep(25000); } } Example 1 produces the desired output 2 and 5 whereas Example 2 returns 5 and 5. The only difference being that in Example 1 two variables were used (y and z) to write data to the hashtable whereas Example 2 uses only one variable (y). IMO both cases should produce the very same output, but they obviously don't. Could anyone explain to me why not? I don't understand the logic behind this. Do I always have to use different variables when writing to a hashtable? That would be very inconvinient, especially if the table were to consist of hundreds or even thousands of items! Any help is greatly appreciated! Thans for your efforts!!! Mazze
 Re: Arrays in Hashtables Guffa1-Jul-06 23:51 Guffa 1-Jul-06 23:51
 Re: Arrays in Hashtables Mazze.ger2-Jul-06 1:34 Mazze.ger 2-Jul-06 1:34
 Re: Arrays in Hashtables Guffa2-Jul-06 1:49 Guffa 2-Jul-06 1:49
 Re: Arrays in Hashtables Mazze.ger2-Jul-06 2:17 Mazze.ger 2-Jul-06 2:17
 how ot Windows Service foysal mamun1-Jul-06 21:35 foysal mamun 1-Jul-06 21:35
 Re: how ot Windows Service Nader Elshehabi2-Jul-06 1:43 Nader Elshehabi 2-Jul-06 1:43
 Re: how ot Windows Service Ravi Bhavnani2-Jul-06 4:57 Ravi Bhavnani 2-Jul-06 4:57
 Re: how ot Windows Service Paul Conrad2-Jul-06 12:52 Paul Conrad 2-Jul-06 12:52
 Capturing video from webcam using .NET dmee1-Jul-06 20:33 dmee 1-Jul-06 20:33
 Re: Capturing video from webcam using .NET Ed.Poore1-Jul-06 23:23 Ed.Poore 1-Jul-06 23:23
 Re: Capturing video from webcam using .NET LongRange.Shooter3-Jul-06 5:26 LongRange.Shooter 3-Jul-06 5:26
 Text file parsing Zeikcied1-Jul-06 19:17 Zeikcied 1-Jul-06 19:17
 Re: Text file parsing tjvictor1-Jul-06 19:25 tjvictor 1-Jul-06 19:25
 Re: Text file parsing LongRange.Shooter3-Jul-06 5:35 LongRange.Shooter 3-Jul-06 5:35
 Re: Text file parsing Zeikcied8-Jul-06 18:18 Zeikcied 8-Jul-06 18:18
 Re: Text file parsing LongRange.Shooter9-Jul-06 5:06 LongRange.Shooter 9-Jul-06 5:06
 Last Visit: 31-Dec-99 18:00     Last Update: 24-May-24 3:32 Refresh ᐊ Prev1...11092110931109411095110961109711098110991110011101 Next ᐅ