Posted on 2006-07-18
I have a class
SendReceive ??? (This is what the question is about)
Its a web app so each time a user runs the page, 6 of these class objects are created in an object array (one for each company). Each object knows its position in the array through the ArrayIndexNumber property. The CreateXMLRequest method adds the RequestXML property.
Now my original plan was to do this:
As each object is created (in a loop), the SendReceive method is started on a separate thread and will post RequestXML off to the appropriate CompanyURL. Because of the way you send information to a thread (you pass an instantiated object), I thought that SendReceive should be a sub routine outside the class which will receive each of the objects in the array as they are created. This is the reason for instantiating the object with its ArrayIndex number so that it knows which position in the array it should go back to.
So my feelings are that the SendReceive method should remain outside the class.
However, my colleague (he's writing the app) has put the SendReceive method inside the class so this is what is happening at the moment:
ObjectInstance Instantiated in array
ObjectInstance Passed to ObjectInstance.SendReceive method (this is how)
So you are passing the object back to itself??? Is this OK?
Would appreciate some other opinions on this as it somehow does not seem right to me.
If u need further info, please ask