Dear Coders:
I have a hashtable,
Hashtable hash=new Hashtable();
and have a class, Pixels
class Pixels
{
public int[,] buf=new int[5,5];
..
..
..
}
when I set this
Pixels p=new Pixels;
p.buf[1,1]=0;
p.buf[2,2]=1;
hash[5]=p;
Pixels p2=hash[5];
!!! now all items of buf[,] are set to 1 1 1306
Hello,
I have tried this out and i am getting right result.
The code is
class Class1
{
[STAThread]
static void Main(string[] args)
{
Hashtable hash=new Hashtable();
Pixels p=new Pixels( );
p.buf[1,1]=0;
p.buf[2,2]=1;
hash[5]=p;
Pixels p2=hash[5] as Pixels;
Console.Write( p2.buf[1,1] + " " + p2.buf[2,2]);
}
}
class Pixels
{
public int[,] buf=new int[5,5];
}
"bi************ @gmail.com" wrote: Dear Coders:
I have a hashtable,
Hashtable hash=new Hashtable();
and have a class, Pixels
class Pixels { public int[,] buf=new int[5,5]; .. .. ..
}
when I set this Pixels p=new Pixels; p.buf[1,1]=0; p.buf[2,2]=1;
hash[5]=p;
Pixels p2=hash[5];
!!! now all items of buf[,] are set to 1
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Sundial Services |
last post by:
I recently brought an old application out of mothballs and launched it under
PHP5, only to get this message:
Fatal Error: Class '1' not found
It was clearly somehow an /execution/ time problem, because it did not
appear on the first page I had linked to, all of which use the same
includes. Even though it appears to be a compile-time...
|
by: janek |
last post by:
I have a question:
what differences are between:
namespace Mary {
int r = 5 ;
char m ;
|
by: Abdullah Kauchali |
last post by:
Hi folks,
Can one rely on the order of keys inserted into an associative Javascript
array? For example:
var o = new Object();
o = "Adam";
o = "Eve";
|
by: Stephen Johns |
last post by:
I want to have a Hashtable whose keys are strings and whose values are
delegates.
Well, ok, I have that:
dels = new Hastable();
dels.Add( "key", new Foo1Delegate(MyFoo1) );
dels.Add( "key", new Foo2Delegate(MyFoo2) );
dels.Add( "key", new Foo3Delegate(MyFoo3) );
|
by: MIGUEL |
last post by:
Hi all!
Be patient because what I'm going to explain all of you it's more than
very strange.
I've developed a webservice project that contains two classes. One of
them is going to act as a SOAP header, and the other class is the main
class containing all the web methods. Besides, the project contains
two references pointing at two normal...
| |
by: John Nossluap |
last post by:
I've got a third-party assembly dll containing an "internal" class with
some public methods I would very much like to use.
I understand the meaning and reason of setting the accessibility of the
class to internal. But is there any way, dirty or not, I could use this
class and its methods anyway?
|
by: Kimmo Laine |
last post by:
I'm flipping my wig here, people. I'm using classes and making each class a
file. when I'm including dependet classess, I use require_once to avoid
multiple declarations - yet they happen. I put debug_print_backtrace in the
file to see how it is included, and here's the output:
#0 require_once() called at
#1 ...
|
by: Martin Plechsmid |
last post by:
Hello,
(After investigating my real problem) I've got a C# web service containing a
single method:
public MyBDO Test()
{
return null;
}
|
by: Christian Joergensen |
last post by:
Hello
I stumpled upon this "feature" during my work tonight, and found it
a bit confusing:
.... class C:
.... foobar = 42
....
....
<class __main__.C at 0xb7cf735c>
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |