Passing an interface as a method parameter is a totally valid thing to do. Consider this:
interface IPolygon
{
void Draw();
}
class Visio
{
public void DrawDiagram(IPolygon[] shapes)
{
foreach( IPolygon p in shapes )
{
p.Draw();
}
}
}
So you would think Visio should know better ;-)
Regards
Richard Blewett - DevelopMentor
http://staff.develop.com/richardb/weblog
nntp://news.microsoft.com/microsoft.public.dotnet.languages.csharp/<#P**************@tk2msftngp13.phx.gbl>
What is the advantage of passing an interface type?
according to UML (visio) when i reverse engineer existing code to a UML
diagram I get the error
"UMLE00046: sample[Parameter] : [Parameter - WFR1] - An interface cannot be
used as the type of a parameter."
for this code:
public void OnUpdate(CCC.Sys.TestProc.ISample sample)
{
however the application does compile and run correctly.
Yes its not my code.
What is the advantage of passing an interface type?
Since UML doesn't like it should I not do it?
Thanks
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (
http://www.grisoft.com).
Version: 6.0.766 / Virus Database: 513 - Release Date: 17/09/2004
[microsoft.public.dotnet.languages.csharp]