| | |
Using Interface and interface members in C#
Please support our C# advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
What is the difference between following declarations:
I want to know the difference in usage and the the one that is most efficient in terms of programming in C#.
C# Syntax (Toggle Plain Text)
WebUserService.Service.IUserService userService = new WebUserService.Service.UserService(); WebUserService.Service.UserService userService = new WebUserService.Service.UserService();
I want to know the difference in usage and the the one that is most efficient in terms of programming in C#.
Last edited by nccsbim071; Nov 8th, 2009 at 2:33 am.
My Personnel Blog:dotnetworker.blogspot.com
My Company:http://www.bizpersonnel.com
Blog:http://bizpersonnel.wordpress.com
My Company:http://www.bizpersonnel.com
Blog:http://bizpersonnel.wordpress.com
0
#2 Nov 8th, 2009
The only difference is that you are holding on to a reference of the interface versus the class. The class implements more functionality than the interface but you can also cast the interface reference to the class and still call any method. As far as efficiency there is no difference. Both lines are instantiating a
UserService . 0
#3 Nov 9th, 2009
thanks sknake
My Personnel Blog:dotnetworker.blogspot.com
My Company:http://www.bizpersonnel.com
Blog:http://bizpersonnel.wordpress.com
My Company:http://www.bizpersonnel.com
Blog:http://bizpersonnel.wordpress.com
![]() |
Similar Threads
- Interface for abstract class (C#)
- Problem with public interface (C#)
- Interface (Java)
- Tree interface for ArrayList (Java)
- I implemented a String, how well or how bad it is implemented? (C++)
- What do you mean by Device Interface..?? (Visual Basic 4 / 5 / 6)
- Paint interface (Java)
- What is the difference between abstract class and interface (Java)
- Inserting objects into an array (C++)
- How to use interface of a dll which is developed in C#>NET in my VC++.NET appli (C++)
Other Threads in the C# Forum
- Previous Thread: Small error in simple XNA app
- Next Thread: not able read special charactered strings -EXCEL to DataSet-C#
Views: 271 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for interface







