Hey guys
I have an instance of an object say:
List<Object> myList = new List<Object>();
Object myObject = new Object();
myObject.Positi onVector = new Vector3(10,10,1 0);
myList.Add(myOb ject);
With the above code as an accurate example i do that in a loop. And on each
iteration i change the position vector, however when i do this and check my
list it has correctly added each new instance as a separate entry but they
all have the position of the last one to be added. When i steped through it
in debug this was verified, the correct positon details are in on one
iteration and on the next iteration immediately after the new instance has
its position changed so too does the one already in my List.
I presume that a new memory allocation isn't being made and so on setting
position it overwrites the same memory my list is looking at but why? I
thought the 'new' operator explicitly tells it to create a new memory
allocation? Am i missing something? Anyone know how i can prevent this
situation.
Thanks
May 1 '06
18 1751
Daniel <Da*****@vestry online.com> wrote: This goes through one huge class, which calls another class which is inherited down from two more. Its impossbile to show a complete example.
No it's not. It just requires a little work. No-one's asking you to
post everything in your real classes - just enough for us to compile
and run a program which demonstrates the problem.
Hence my original shortened version that showed only the parts needed to recreate my problem. Ok i will sort this one out for myself, thanks anyway.
It's great to show a shortened version that only shows the parts needed
- but it *didn't* allow anyone to recreate the problem. You need to
post:
1) Enough that people can compile and run the program
2) Not too much: nothing that isn't required to show the problem
3) What you expect to happen and what actually happened
--
Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Thanks Jon
unfortunately i really dont know how to on this one, usually when i post an
issue i provide all the information needed. I know its difficult to help
when someone gives not everything but the reason i am having a problem may
be due to how complex this piece of code that uses it is.
I would have to rewrite my code anyway to give a shortened version to pull
out the non-needed parts then post that. As someone earlier stated using my
short eample they found no problems so i guess the issue is elsewhere.
Either way its very strange and for such a simple requirement i was
surprised to have a problem. It's ok i will sort it, nothing worse than
someone asking for help and unable to give help to those trying to help.
Hopefully i will get it.
"Jon Skeet [C# MVP]" <sk***@pobox.co m> wrote in message
news:MP******** *************** @msnews.microso ft.com... Daniel <Da*****@vestry online.com> wrote: This goes through one huge class, which calls another class which is inherited down from two more. Its impossbile to show a complete example.
No it's not. It just requires a little work. No-one's asking you to post everything in your real classes - just enough for us to compile and run a program which demonstrates the problem.
Hence my original shortened version that showed only the parts needed to recreate my problem. Ok i will sort this one out for myself, thanks anyway.
It's great to show a shortened version that only shows the parts needed - but it *didn't* allow anyone to recreate the problem. You need to post:
1) Enough that people can compile and run the program 2) Not too much: nothing that isn't required to show the problem 3) What you expect to happen and what actually happened
-- Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet If replying to the group, please do not mail me too
What does ObjectID.Cards contain? Will it be a different number for each
iteration in the loop? If it won't, then you will get the same instance
from the GetObject method.
The GetObject method never creates new objects, it only returns objects
from the list in the _objMan object. That is the main difference from
the example code you showed first.
Daniel wrote: Ok my apologies here is the exact code,
On my external class that calls the code withina loop.
PlayingCard theCardSceneObj = new PlayingCard();
theCardSceneObj = (PlayingCard)_o bjMan.GetObject ((int)ObjectID. Cards);
theCardSceneObj .SetCardFrame(p layer.Hand[j]);
theCardSceneObj .FaceUp = player.Hand[j].ShowState;
theCardSceneObj .IsVisible = true;
theCardSceneObj .Position = new Vector3(seatPos .X + (j * 15), seatPos.Y + (j * 10), 0);
_objMan.AddToRe nderList(theCar dSceneObj); Inside the_objMan instance:
class ObjectManager
{
List<SceneObjec t> _sceneObjList;
List<SceneObjec t> __renderList;
public ObjectManager()
{
_sceneObjList = new List<SceneObjec t>();
}
public void AddToRenderList (SceneObject so) { _renderList.Add (so); }
public object GetObject(int ObjectId)
{
int count = 0;
foreach (SceneObject so in _sceneObjList)
{
if (so.ObjectID == ObjectId)
return _sceneObjList[count];
count++;
}
return null;
}
That any clearer?
"Göran Andersson" <gu***@guffa.co m> wrote in message news:u1******** ******@TK2MSFTN GP03.phx.gbl... No, sorry, the code you show is *not* an accurate example. If you can't show the actual code you are using, you have to at least show a complete example that will actually show the problem you are talking about.
It's near to impossible to locate an error in a code by looking at some other code that doesn't even have the error in it.
Think of it as going to your local mecanic, show him a picture of your bike, and ask him why you car is not starting... ;)
Daniel wrote: Hey guys
I have an instance of an object say:
List<Object> myList = new List<Object>();
Object myObject = new Object(); myObject.Positi onVector = new Vector3(10,10,1 0);
myList.Add(myOb ject);
With the above code as an accurate example i do that in a loop. And on each iteration i change the position vector, however when i do this and check my list it has correctly added each new instance as a separate entry but they all have the position of the last one to be added. When i steped through it in debug this was verified, the correct positon details are in on one iteration and on the next iteration immediately after the new instance has its position changed so too does the one already in my List.
I presume that a new memory allocation isn't being made and so on setting position it overwrites the same memory my list is looking at but why? I thought the 'new' operator explicitly tells it to create a new memory allocation? Am i missing something? Anyone know how i can prevent this situation.
Thanks
"Daniel" <Da*****@vestry online.com> a écrit dans le message de news: eL************* *@TK2MSFTNGP05. phx.gbl...
| unfortunately i really dont know how to on this one, usually when i post
an
| issue i provide all the information needed. I know its difficult to help
| when someone gives not everything but the reason i am having a problem may
| be due to how complex this piece of code that uses it is.
|
| I would have to rewrite my code anyway to give a shortened version to pull
| out the non-needed parts then post that. As someone earlier stated using
my
| short eample they found no problems so i guess the issue is elsewhere.
| Either way its very strange and for such a simple requirement i was
| surprised to have a problem. It's ok i will sort it, nothing worse than
| someone asking for help and unable to give help to those trying to help.
| Hopefully i will get it.
All you have to post to make this understandable is the part of the
PlayingCard class that includes the Position property, as that is the
property that you state is always the same for all instances of the
PlayingCard class.
e.g.
public class PlayingCard
{
private Vector3 position;
public Vector3 Position
{
get { return position; }
set { position = value; }
}
}
Does this look anything like the property declared in your class ?
Joanna
--
Joanna Carter [TeamB]
Consultant Software Engineer
Hi Goran
Yes it does because i get the object but i did this
PlayingCard pc = new PlayingCard();
pc = GetObject(objec tId); etc etc
And i still had the same problem.
In response to the other question, yes thats how my position method looks.
"Göran Andersson" <gu***@guffa.co m> wrote in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. .. What does ObjectID.Cards contain? Will it be a different number for each iteration in the loop? If it won't, then you will get the same instance from the GetObject method.
The GetObject method never creates new objects, it only returns objects from the list in the _objMan object. That is the main difference from the example code you showed first.
Daniel wrote: Ok my apologies here is the exact code,
On my external class that calls the code withina loop.
PlayingCard theCardSceneObj = new PlayingCard();
theCardSceneObj = (PlayingCard)_o bjMan.GetObject ((int)ObjectID. Cards);
theCardSceneObj .SetCardFrame(p layer.Hand[j]);
theCardSceneObj .FaceUp = player.Hand[j].ShowState;
theCardSceneObj .IsVisible = true;
theCardSceneObj .Position = new Vector3(seatPos .X + (j * 15), seatPos.Y + (j * 10), 0);
_objMan.AddToRe nderList(theCar dSceneObj); Inside the_objMan instance:
class ObjectManager
{
List<SceneObjec t> _sceneObjList;
List<SceneObjec t> __renderList;
public ObjectManager()
{
_sceneObjList = new List<SceneObjec t>();
}
public void AddToRenderList (SceneObject so) { _renderList.Add (so); }
public object GetObject(int ObjectId)
{
int count = 0;
foreach (SceneObject so in _sceneObjList)
{
if (so.ObjectID == ObjectId)
return _sceneObjList[count];
count++;
}
return null;
}
That any clearer?
"Göran Andersson" <gu***@guffa.co m> wrote in message news:u1******** ******@TK2MSFTN GP03.phx.gbl... No, sorry, the code you show is *not* an accurate example. If you can't show the actual code you are using, you have to at least show a complete example that will actually show the problem you are talking about.
It's near to impossible to locate an error in a code by looking at some other code that doesn't even have the error in it.
Think of it as going to your local mecanic, show him a picture of your bike, and ask him why you car is not starting... ;)
Daniel wrote: Hey guys
I have an instance of an object say:
List<Object> myList = new List<Object>();
Object myObject = new Object(); myObject.Positi onVector = new Vector3(10,10,1 0);
myList.Add(myOb ject);
With the above code as an accurate example i do that in a loop. And on each iteration i change the position vector, however when i do this and check my list it has correctly added each new instance as a separate entry but they all have the position of the last one to be added. When i steped through it in debug this was verified, the correct positon details are in on one iteration and on the next iteration immediately after the new instance has its position changed so too does the one already in my List.
I presume that a new memory allocation isn't being made and so on setting position it overwrites the same memory my list is looking at but why? I thought the 'new' operator explicitly tells it to create a new memory allocation? Am i missing something? Anyone know how i can prevent this situation.
Thanks
SceneChair chair = (SceneChair)_ob jMan.GetObject( (int)ObjectID.S eats);
chair.Position = GetSeatPosition (1);
chair.FrameNum = 1;
_objMan.AddToRe nderStack(chair );
SceneChair chair2 = new SceneChair();
chair2 = chair;
chair2.Position = GetSeatPosition (3);
chair2.FrameNum = 2;
_objMan.AddToRe nderStack(chair 2);
Ok in the above code when i debug, at the line chair2.Position both
instances are equal in data as you would expect.
Now when i go to the final _objMan.AddToRe nderStack line both the chair
instance and the chair2 instance framenumbers become 2. But i only changed
chair2's one so chair being a differenct instance shouldnt be effected
right?
The SceneChair chair2 = new SceneChair(); should have created a new memory
space and then when i changed chair2's framenum the memory allocated for
chair2 shoudl change while chair's remains the same. Am i right? So why do
they both change later on??? This is why when i add it to my stack they are
equal, as it is changing them as i said before while on the stack as if it
were the same instance.
"Göran Andersson" <gu***@guffa.co m> wrote in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. .. What does ObjectID.Cards contain? Will it be a different number for each iteration in the loop? If it won't, then you will get the same instance from the GetObject method.
The GetObject method never creates new objects, it only returns objects from the list in the _objMan object. That is the main difference from the example code you showed first.
Daniel wrote: Ok my apologies here is the exact code,
On my external class that calls the code withina loop.
PlayingCard theCardSceneObj = new PlayingCard();
theCardSceneObj = (PlayingCard)_o bjMan.GetObject ((int)ObjectID. Cards);
theCardSceneObj .SetCardFrame(p layer.Hand[j]);
theCardSceneObj .FaceUp = player.Hand[j].ShowState;
theCardSceneObj .IsVisible = true;
theCardSceneObj .Position = new Vector3(seatPos .X + (j * 15), seatPos.Y + (j * 10), 0);
_objMan.AddToRe nderList(theCar dSceneObj); Inside the_objMan instance:
class ObjectManager
{
List<SceneObjec t> _sceneObjList;
List<SceneObjec t> __renderList;
public ObjectManager()
{
_sceneObjList = new List<SceneObjec t>();
}
public void AddToRenderList (SceneObject so) { _renderList.Add (so); }
public object GetObject(int ObjectId)
{
int count = 0;
foreach (SceneObject so in _sceneObjList)
{
if (so.ObjectID == ObjectId)
return _sceneObjList[count];
count++;
}
return null;
}
That any clearer?
"Göran Andersson" <gu***@guffa.co m> wrote in message news:u1******** ******@TK2MSFTN GP03.phx.gbl... No, sorry, the code you show is *not* an accurate example. If you can't show the actual code you are using, you have to at least show a complete example that will actually show the problem you are talking about.
It's near to impossible to locate an error in a code by looking at some other code that doesn't even have the error in it.
Think of it as going to your local mecanic, show him a picture of your bike, and ask him why you car is not starting... ;)
Daniel wrote: Hey guys
I have an instance of an object say:
List<Object> myList = new List<Object>();
Object myObject = new Object(); myObject.Positi onVector = new Vector3(10,10,1 0);
myList.Add(myOb ject);
With the above code as an accurate example i do that in a loop. And on each iteration i change the position vector, however when i do this and check my list it has correctly added each new instance as a separate entry but they all have the position of the last one to be added. When i steped through it in debug this was verified, the correct positon details are in on one iteration and on the next iteration immediately after the new instance has its position changed so too does the one already in my List.
I presume that a new memory allocation isn't being made and so on setting position it overwrites the same memory my list is looking at but why? I thought the 'new' operator explicitly tells it to create a new memory allocation? Am i missing something? Anyone know how i can prevent this situation.
Thanks
First - this does not compile.
Second - we don't know the definition of GetSeatPosition , SceneChair, type
of _objMan, definition of its GetObject and AddToRenderStac k method,
SceneChair class definition,...
How can we help you if WE can not recreate the problem? Jon Skeet has
already provided you advice how to structure your question, but I think he
did not send you the link: http://www.yoda.arachsys.com/csharp/complete.html
Can you post a complete program (OK, the thing you have posted is short
enough, just make it complete) that demonstrates the problem?
"Daniel" <Da*****@vestry online.com> wrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. .. SceneChair chair = (SceneChair)_ob jMan.GetObject( (int)ObjectID.S eats);
chair.Position = GetSeatPosition (1);
chair.FrameNum = 1;
_objMan.AddToRe nderStack(chair );
SceneChair chair2 = new SceneChair();
chair2 = chair;
chair2.Position = GetSeatPosition (3);
chair2.FrameNum = 2;
_objMan.AddToRe nderStack(chair 2); Ok in the above code when i debug, at the line chair2.Position both instances are equal in data as you would expect.
Now when i go to the final _objMan.AddToRe nderStack line both the chair instance and the chair2 instance framenumbers become 2. But i only changed chair2's one so chair being a differenct instance shouldnt be effected right? The SceneChair chair2 = new SceneChair(); should have created a new memory space and then when i changed chair2's framenum the memory allocated for chair2 shoudl change while chair's remains the same. Am i right? So why do they both change later on??? This is why when i add it to my stack they are equal, as it is changing them as i said before while on the stack as if it were the same instance.
"Göran Andersson" <gu***@guffa.co m> wrote in message news:%2******** ********@TK2MSF TNGP03.phx.gbl. .. What does ObjectID.Cards contain? Will it be a different number for each iteration in the loop? If it won't, then you will get the same instance from the GetObject method.
The GetObject method never creates new objects, it only returns objects from the list in the _objMan object. That is the main difference from the example code you showed first.
Daniel wrote: Ok my apologies here is the exact code,
On my external class that calls the code withina loop.
PlayingCard theCardSceneObj = new PlayingCard();
theCardSceneObj = (PlayingCard)_o bjMan.GetObject ((int)ObjectID. Cards);
theCardSceneObj .SetCardFrame(p layer.Hand[j]);
theCardSceneObj .FaceUp = player.Hand[j].ShowState;
theCardSceneObj .IsVisible = true;
theCardSceneObj .Position = new Vector3(seatPos .X + (j * 15), seatPos.Y + (j * 10), 0);
_objMan.AddToRe nderList(theCar dSceneObj); Inside the_objMan instance:
class ObjectManager
{
List<SceneObjec t> _sceneObjList;
List<SceneObjec t> __renderList;
public ObjectManager()
{
_sceneObjList = new List<SceneObjec t>();
}
public void AddToRenderList (SceneObject so) { _renderList.Add (so); }
public object GetObject(int ObjectId)
{
int count = 0;
foreach (SceneObject so in _sceneObjList)
{
if (so.ObjectID == ObjectId)
return _sceneObjList[count];
count++;
}
return null;
}
That any clearer?
"Göran Andersson" <gu***@guffa.co m> wrote in message news:u1******** ******@TK2MSFTN GP03.phx.gbl... No, sorry, the code you show is *not* an accurate example. If you can't show the actual code you are using, you have to at least show a complete example that will actually show the problem you are talking about.
It's near to impossible to locate an error in a code by looking at some other code that doesn't even have the error in it.
Think of it as going to your local mecanic, show him a picture of your bike, and ask him why you car is not starting... ;)
Daniel wrote: > Hey guys > > I have an instance of an object say: > > List<Object> myList = new List<Object>(); > > Object myObject = new Object(); > myObject.Positi onVector = new Vector3(10,10,1 0); > > myList.Add(myOb ject); > > > With the above code as an accurate example i do that in a loop. And on > each iteration i change the position vector, however when i do this > and check my list it has correctly added each new instance as a > separate entry but they all have the position of the last one to be > added. When i steped through it in debug this was verified, the > correct positon details are in on one iteration and on the next > iteration immediately after the new instance has its position changed > so too does the one already in my List. > > I presume that a new memory allocation isn't being made and so on > setting position it overwrites the same memory my list is looking at > but why? I thought the 'new' operator explicitly tells it to create a > new memory allocation? Am i missing something? Anyone know how i can > prevent this situation. > > Thanks
As i said before i cannot do that.
First there is too much to send and second this code is protected and
copyrighted so i will not be pasting large segements on a newsgroup.
I thought maybe i had overlooked something simple and someone was going to
say 'ah your not understaing how the new operator works' or something like
that. So don't worry clearly this is not a simple thing to fix and requires
going through a lot of code to see why these instances are not acting as
they should.
Thanks for your help but unfortunately i cannot provide more code,
definitely not a compilable version.
"Lebesgue" <le******@gmail .com> wrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. .. First - this does not compile. Second - we don't know the definition of GetSeatPosition , SceneChair, type of _objMan, definition of its GetObject and AddToRenderStac k method, SceneChair class definition,...
How can we help you if WE can not recreate the problem? Jon Skeet has already provided you advice how to structure your question, but I think he did not send you the link: http://www.yoda.arachsys.com/csharp/complete.html Can you post a complete program (OK, the thing you have posted is short enough, just make it complete) that demonstrates the problem?
"Daniel" <Da*****@vestry online.com> wrote in message news:%2******** ********@TK2MSF TNGP05.phx.gbl. .. SceneChair chair = (SceneChair)_ob jMan.GetObject( (int)ObjectID.S eats);
chair.Position = GetSeatPosition (1);
chair.FrameNum = 1;
_objMan.AddToRe nderStack(chair );
SceneChair chair2 = new SceneChair();
chair2 = chair;
chair2.Position = GetSeatPosition (3);
chair2.FrameNum = 2;
_objMan.AddToRe nderStack(chair 2); Ok in the above code when i debug, at the line chair2.Position both instances are equal in data as you would expect.
Now when i go to the final _objMan.AddToRe nderStack line both the chair instance and the chair2 instance framenumbers become 2. But i only changed chair2's one so chair being a differenct instance shouldnt be effected right? The SceneChair chair2 = new SceneChair(); should have created a new memory space and then when i changed chair2's framenum the memory allocated for chair2 shoudl change while chair's remains the same. Am i right? So why do they both change later on??? This is why when i add it to my stack they are equal, as it is changing them as i said before while on the stack as if it were the same instance.
"Göran Andersson" <gu***@guffa.co m> wrote in message news:%2******** ********@TK2MSF TNGP03.phx.gbl. .. What does ObjectID.Cards contain? Will it be a different number for each iteration in the loop? If it won't, then you will get the same instance from the GetObject method.
The GetObject method never creates new objects, it only returns objects from the list in the _objMan object. That is the main difference from the example code you showed first.
Daniel wrote: Ok my apologies here is the exact code,
On my external class that calls the code withina loop.
PlayingCard theCardSceneObj = new PlayingCard();
theCardSceneObj = (PlayingCard)_o bjMan.GetObject ((int)ObjectID. Cards);
theCardSceneObj .SetCardFrame(p layer.Hand[j]);
theCardSceneObj .FaceUp = player.Hand[j].ShowState;
theCardSceneObj .IsVisible = true;
theCardSceneObj .Position = new Vector3(seatPos .X + (j * 15), seatPos.Y + (j * 10), 0);
_objMan.AddToRe nderList(theCar dSceneObj); Inside the_objMan instance:
class ObjectManager
{
List<SceneObjec t> _sceneObjList;
List<SceneObjec t> __renderList;
public ObjectManager()
{
_sceneObjList = new List<SceneObjec t>();
}
public void AddToRenderList (SceneObject so) { _renderList.Add (so); }
public object GetObject(int ObjectId)
{
int count = 0;
foreach (SceneObject so in _sceneObjList)
{
if (so.ObjectID == ObjectId)
return _sceneObjList[count];
count++;
}
return null;
}
That any clearer?
"Göran Andersson" <gu***@guffa.co m> wrote in message news:u1******** ******@TK2MSFTN GP03.phx.gbl... > No, sorry, the code you show is *not* an accurate example. If you > can't show the actual code you are using, you have to at least show a > complete example that will actually show the problem you are talking > about. > > It's near to impossible to locate an error in a code by looking at > some other code that doesn't even have the error in it. > > Think of it as going to your local mecanic, show him a picture of your > bike, and ask him why you car is not starting... ;) > > Daniel wrote: >> Hey guys >> >> I have an instance of an object say: >> >> List<Object> myList = new List<Object>(); >> >> Object myObject = new Object(); >> myObject.Positi onVector = new Vector3(10,10,1 0); >> >> myList.Add(myOb ject); >> >> >> With the above code as an accurate example i do that in a loop. And >> on each iteration i change the position vector, however when i do >> this and check my list it has correctly added each new instance as a >> separate entry but they all have the position of the last one to be >> added. When i steped through it in debug this was verified, the >> correct positon details are in on one iteration and on the next >> iteration immediately after the new instance has its position changed >> so too does the one already in my List. >> >> I presume that a new memory allocation isn't being made and so on >> setting position it overwrites the same memory my list is looking at >> but why? I thought the 'new' operator explicitly tells it to create a >> new memory allocation? Am i missing something? Anyone know how i can >> prevent this situation. >> >> Thanks
Daniel <Da*****@vestry online.com> wrote: SceneChair chair = (SceneChair)_ob jMan.GetObject( (int)ObjectID.S eats);
chair.Position = GetSeatPosition (1);
chair.FrameNum = 1;
_objMan.AddToRe nderStack(chair );
SceneChair chair2 = new SceneChair();
chair2 = chair;
chair2.Position = GetSeatPosition (3);
chair2.FrameNum = 2;
_objMan.AddToRe nderStack(chair 2);
Ok in the above code when i debug, at the line chair2.Position both instances are equal in data as you would expect.
Now when i go to the final _objMan.AddToRe nderStack line both the chair instance and the chair2 instance framenumbers become 2. But i only changed chair2's one so chair being a differenct instance shouldnt be effected right?
No. You're creating a new object in the line
SceneChair chair2 = new SceneChair();
but then you're immediately making that object useless by doing:
chair2 = chair;
At that point, chair2 and chair both reference the same object, so when
you make changes to that object, you'll see the changes through either
of the variables.
--
Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: delraydog |
last post by:
If you've used the Google Gmail spell checker you know that it
'changes' the text area to another type of control that lets them show
hyperlinks for the incorrect words. How does Google change the
textarea? And what do they change it to? I know it should be pretty
simple, I just have no clue because I'm fairly new to DHTML. Any
examples would be greatly appreciated.
Thanks!
Cliff.
delraydog@gmail.com
|
by: Lance |
last post by:
Hi All,
I change the current directory in a proc, using CurDir(). The change
persists across executions. I would like the CurDir() return value to be the
same at the start of each execution. Any suggestions will be appreciated.
The code below illustrates the problem. Thanks.
Dim currentDir As String
MsgBox CurDir()
|
by: Tim Begin |
last post by:
I am attempting to use the ThreadPool.SetMinThreads method as shown in the MSDN example code:
int minWorker, minIOPort;
int newWorker,newIOPort;
ThreadPool.GetAvailableThreads(out minWorker, out minIOPort);
bool flag = ThreadPool.SetMinThreads(4, minIOPort);
ThreadPool.GetAvailableThreads(out newWorker, out newIOPort);
After running this flag is true, but the worker value is still set to 25.
I am using .Net 1.1.4322 and this call was...
|
by: Marc Robitaille |
last post by:
Hello,
Hello,
I developed a UserControl. It has funny behavior. It is composed of three
controls. A texbox, a combobox and a button. There are three properties to
indicate the visibility of the three controls. The only property which
functions well is the one for the button. The two others, even if I do:
UserControl.TextboxVisible = True or UserControl.ComboboxVisible = True, the
textbox or the combobox remain invisible. I placed a...
|
by: stef mientki |
last post by:
hello,
Why does Configparser change names to lowercase ?
As Python is case sensitive (which btw I don't like at all ;-)
but now when really need the casesensitivity,
because it handles about names which should be recognized by human,
it changes everything to lowercase ????
thanks,
| |
by: nma |
last post by:
Hi
Why the code below does not change the color. I can only see the pointer change only but it does not change the color?
Please help and Thnaks
nma
<td width="100" height="17"><a href="some.html" onmouseover="document.t6.src=Image3.src;" onmouseout="document.t6.src=Image2.src;"><img name="t6" src="Highlight.jpg" width="100" height="17" border="0"></a></td>
|
by: bryanleo |
last post by:
We are trying to read data from a microcontroller and interface it through serial port. The output is then displayed in Python using Pyserial or the hyperterminal, the former is more important
When you touch the input pins of the microcontroller the value changes real time in hyper terminal. But In the case of the pyserial module, even though you touch the input pins, the value does not change. We have actually noticed that python records and...
|
by: bibhukdas |
last post by:
Hi All,
Just to elaborate on the issue. The requirement is to handle this in javascript
1. User clicks on a button
2. Change the cursor style (We are using document.body.style.cursor="wait")
3. Send an Ajax request and do the processing
4. Once the processing is done change back the cursor to original style (We are using document.body.style.cursor="default")
We are able to achieve 1 to 3 .Req 4 is where we have a issue. The issue is...
|
by: Joe Wyrwas |
last post by:
My main program is a Multiple Document Interface (MDI). I create and show 2 or more child forms inside the MDI parent. If I left click on the child forms, the focus and Z-index will change correctly. (E.G. I have form1 and form2 as the child forms, form1 is active. I left click anywhere on form2 and the focus and z-index changes). This works correctly.
However, if I right click on the non-active form the focus and z-index does not change. ...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |