[AccessD] First real stumble with using VB.Net over VB

jwcolby jwcolby at colbyconsulting.com
Sat Apr 16 12:51:16 CDT 2011


Stuart,

C# of course.

http://msdn.microsoft.com/en-us/library/w86s7x04%28v=vs.80%29.aspx

Unlike fields, properties are not classified as variables. Therefore, it is not possible to pass a 
property as a ref (C# Reference) or out (C# Reference) parameter.

Properties have many uses: they can validate data before allowing a change; they can transparently 
expose data on a class where that data is actually retrieved from some other source, such as a 
database; they can take an action when data is changed, such as raising an event, or changing the 
value of other fields.


 >>> from Stack Overflow:
 >>>
One use for a write-only property is to support setter dependency injection.

Let's say I had a class:

public class WhizbangService {
     public WhizbangProvider Provider { set; private get; }
}

The WhizbangProvider is not intended to be accessed by the outside world. I'd never want to interact 
with service.Provider, it's too complex. I need a class like WhizbangService to act as a facade. Yet 
with the setter, I can do something like this:

service.Provider = new FireworksShow();
service.Start();

And the service starts a fireworks display. Or maybe you'd rather see a water and light show:

service.Stop();
service.Provider = new FountainDisplay(new StringOfLights(), 20, UnitOfTime.Seconds);
service.Start();


Expand your mind.  Sit in the sun, close your eyes, contemplate your belly button.

And yes, HoseTheTwitsDown actually is a method - which I was fantasizing about using...

;)

John W. Colby
www.ColbyConsulting.com

On 4/16/2011 12:20 AM, Stuart McLachlan wrote:
> Sorry, I can't accept that;  A write-only property is the local equivalent of this:
> http://www.supersimplestorageservice.com/
>
> If you can't get a meaningful value from it, then it is not a property  - it is a method ( and I
> don't mean a return value indicating success or failure of the SET)
>
> HoseTheTwits Down is a Method.
>



More information about the AccessD mailing list