Re: Why properties cannot be used as ref or out arguments
Dean Cleaver <[email protected]> Mon, 10 Mar 2008 23:52:45 +1300
| Newsgroups | gmane.comp.windows.devel.dotnet.clr |
|---|---|
| Message-ID | <4543A775711185429E59B18055D4167423225F@sxslakl004.xceptionsoftware.com> |
I don't think an interface would work, as this is generic - for example, on one data entry screen, I might have 10 textboxes with strings, 3 with dates etc and I would want to call these generic functions 10 time for the string properties, and 3 times for the date properties - so there's no way my class could implement a single interface for it. And there will be a few places where I want to call the same generic functions, so 1 interface with multiple properties won't work either. Dino -----Original Message----- From: Discussion of development on the .NET platform using any managed language [mailto:[email protected]] On Behalf Of Jon Skeet Sent: Monday, 10 March 2008 22:46 To: [email protected] Subject: Re: [DOTNET-CLR] Why properties cannot be used as ref or out arguments Dean Cleaver wrote: > Ah. Yes. Didn't think of the actual mechanics of how it presented the > properties behind it all. Thank you. > > Is a shame though - or is there any way I can get around it using > delegates? I have a function that I require to set one of two > properties, and return a 3rd? Is it sufficiently general that you could create an interface with the properties in, and then pass an implementation of that interface into the method? You certainly *could* do it with delegates, but it would feel a little ugly. Jon =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D This list is hosted by DevelopMentor(r) http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D This list is hosted by DevelopMentor=AE http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com