Re: Why properties cannot be used as ref or out arguments
Davy J <[email protected]> Mon, 10 Mar 2008 16:20:37 +0100
| Newsgroups | gmane.comp.windows.devel.dotnet.clr |
|---|---|
| Message-ID | <[email protected]> |
All our user controls are based off of one base control, that has a abstract
validate method and a readonly parameter.
/// <summary>
/// Sets the controls passed to readonly
/// </summary>
/// <param name="controls"> an array of controls or variable lenght params
, SetReadOnly(ucSearch,ucResults,ucActions) </param>
public void SetReadOnly(params BaseUserControl[] controls)
{
foreach (BaseUserControl buc in controls)
{
buc.ReadOnly = true;
}
}
and for validating our controls.
/// <summary>
/// Validates the controls.
/// </summary>
/// <param name="controls">1 or more user controls to
validate.</param>
/// <returns>List of Control / Message items.</returns>
public List<KeyValuePair<BaseUserControl, string>>
ValidateControls(params BaseUserControl[] controls)
{
List<KeyValuePair<BaseUserControl, string>> errors = new
List<KeyValuePair<BaseUserControl, string>>();
foreach (BaseUserControl buc in controls)
{
IValidate validate = buc.Validate();
if (validate != null)
{
errors.Add(new KeyValuePair<BaseUserControl,
string>(buc, validate.ErrorMessage));
}
}
return errors;
}
Davy J
On 3/10/08, Dean Cleaver <[email protected]> wrote:
>
> Can you apply a generic 10 times to the same class to apply to 10
> different property pairs?
>
===================================
This list is hosted by DevelopMentorĀ® http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com