Click to See Complete Forum and Search --> : [2.0] Wrapper Class
vkkishore_s
Jun 20th, 2006, 11:59 PM
dear friends
Can any body tell me what is a wrapper class.Do we have those classes in C# and is it possible to use those VC++ wrapper classes in C#.plz tell me.
Thanks for sparing time for me.
cheers
kishore
jmcilhinney
Jun 21st, 2006, 12:09 AM
A wrapper class is a class that wraps another class, i.e. it hides the details of the other class and provides a generally simplified interface to the user. An example of the use of wrapper classes is in COM Interop. When you reference an ActiveX control or other COM object in your .NET code you are actually interacting with a .NET wrapper that has been created for you so that you don't have to interact directly with the unmanaged class.
vkkishore_s
Jun 21st, 2006, 01:15 AM
thank you jmcilhinney
could u please give me one example.i have a vc++ wrapper class can i use it?ho to use a wrapper class in c#
regards
kishore
jmcilhinney
Jun 21st, 2006, 02:31 AM
A class is a class. There's nothing special about a wrapper class. If you define a class that allows the user to interact with another class. An example is my ZIP class in the VB.NET CodeBank. It provides a small number of very easy to use methods that allow the user to compress and extract files and folders from ZIP archives. It doesn't do any of the grunt work itself though. It wraps the #ZipLib library, hiding the complexity of that library from the user behind a simple interface.
As for a class written in C++, you cannot use it directly in a C# project. You can compile it into its own library and then reference that in your project but each .NET project can only use a single language.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.