5
Answers

Copy Object

Photo of Lars Persson

Lars Persson

13y
1.3k
1
I have List-control of objects.

I want find a certain object and save it away for later use.

To do this, I used a foreach-loop and tried to copy the object I found into a new object-variable.

Something like:

Book temporary = null; //Reference to Book-object

foreach (Book B in BookList)
 if (txtBox1.Text.Equals(B.ID.ToString()))
 temporary = B;

But that doesn´t seem to work.

How can I do this?

Answers (5)

0
Photo of Vulpes
NA 98.3k 1.5m 12y
The advantage is that multiple applications can access the classes/methods in the dll without having to worry about how they are implemented and without having to copy the source code into the application itself.

Moreover, as long as the public interface of the classes is not changed the writer of the dll can change the internal code of the classes without it affecting client applications.
Accepted
0
Photo of Jignesh Trivedi
NA 61.3k 14.2m 12y
hi,

yes Agree with Vulpes and you can share it to multiple application (from registering in GAC).

0
Photo of Sukesh Marla
NA 11.8k 1.2m 12y
by that we can reuse same methods in multiple projects, Also creates a boundry between two logics and so increases efficiency. Fr example we separate our database logc from business logic by creating class libraries.