[MonoDevelop] Some changes to ambiences

Michael Hutchinson m.j.hutchinson at gmail.com
Thu Nov 27 20:49:27 EST 2008


On Thu, Nov 27, 2008 at 4:53 PM, Mike Krüger <mkrueger at novell.com> wrote:
>> > public abstract string GetString (IDomVisitable domVisitable,
>> > object settings);
>> >
>> > Why setting is an object ? Because on the caller side nothing changes.
>>
>> Why not strongly typed overloads? These would work just as well, and
>> are more usable -- plus you have compile-time type safety.
>>
>
> Got some inspiration from wpf :). I've first had two overloads one with
> flags and one with settings, but it lead to some code duplication.

IMO strong typing helps to make it clear to the API consumer what kind
of object they are expected to pass.

How about:

public abstract string GetString (IDomVisitable domVisitable,
OutputSettings settings);

public string GetString (IDomVisitable domVisitable, OutputFlags flags)
{
    return GetString (domVisitable, new OutputSettings (flags));
}

-- 
Michael Hutchinson
http://mjhutchinson.com


More information about the Monodevelop-list mailing list