Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Avoiding late binding.
Message
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
00982828
Message ID:
00982919
Vues:
38
Why do you want to avoid reflection? For most applications the penalty will not be too great.

Also, have you considered copying the objects directly?
// create a copy of the bizobj
IFormatter formatter = new BinaryFormatter();
MemoryStream stream = new MemoryStream();
if (bizobj != null)
{
// Save a binary copy of the original information
// for use to restore the original info when the user
// clicks on the cancel button
      formatter.Serialize(stream, bizobj);
}
...
// this is how to restore the copy
if(stream.Length > 0)
{
	stream.Position = 0;
	bizobjCopy = (BizObj)formatter.Deserialize(stream));
}				
Now, there might be some problems doing it this way because in MM.NET the business object is derived from Component and your business objects have to be marked serializable. And you might have extra work to do if your business objects are tied together with an eventing mechanism instead of collections. But its worth a try before you start coding all the details.

See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbtsksavingpropertiesofyourcontrol.asp

>Hi,
>
>Is their in this case an other approach possible to achieve the same effect by means of abstract classes or interfaces without the performance penalty of late binding?
>
>
>Mark
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform