IReadOnlyExtensions
Namespace: Wisej.Web.Markup
Assembly: Wisej.Framework (4.1.0.0)
Adds fluent markup extension methods to the IReadOnly implementation.
- C#
- VB.NET
public class IReadOnlyExtensions
Public Class IReadOnlyExtensions
Methods
OnReadOnlyChanged<TReadOnly>(target, action)
Attaches an action to be executed when the ReadOnlyChanged event is raised.
| Parameter | Type | Description |
|---|---|---|
| TReadOnly | The type that implements IReadOnly. | |
| target | TReadOnly | The target object whose ReadOnlyChanged event is being monitored. |
| action | Action<TReadOnly> | The action to execute when the ReadOnlyChanged event occurs. |
Returns: TReadOnly. The target object, allowing for method chaining.
This extension method allows you to easily attach an action to the ReadOnlyChanged event of an object.
myReadOnlyObject.OnReadOnlyChanged(obj => AlertBox.Show("ReadOnly state changed."));
ReadOnly<TReadOnly>(target, value)
Sets the read-only status of the specified target object.
| Parameter | Type | Description |
|---|---|---|
| TReadOnly | The type of the target object, which must implement IReadOnly. | |
| target | TReadOnly | The target object whose read-only status is to be set. |
| value | Boolean | A boolean value indicating the desired read-only status. |
Returns: TReadOnly. The target object with the updated read-only status.
This extension method allows you to set the read-only status of an object that implements the IReadOnly interface.
var myObject = new MyReadOnlyObject();
myObject.ReadOnly(false);