Skip to content

Commit c519ba0

Browse files
authored
chore: Enhance XML documentation for activation and binding APIs (#4276)
<!-- Please be sure to read the [Contribute](https://github.com/reactiveui/reactiveui#contribute) section of the README --> **What kind of change does this PR introduce?** <!-- Bug fix, feature, docs update, ... --> Docs **What is the new behavior?** <!-- If this is a feature change --> Expanded and clarified XML documentation comments for activation-related extension methods and command binding helpers. The updates provide more detailed usage guidance, parameter descriptions, remarks, and exception information to improve developer understanding and API discoverability. **What might this PR break?** No functional code changes were made. **Please check if the PR fulfills these requirements** - [ ] Tests for the changes have been added (for bug fixes / features) - [x] Docs have been added / updated (for bug fixes / features) **Other information**:
1 parent 40290d7 commit c519ba0

File tree

156 files changed

+1614
-909
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+1614
-909
lines changed

src/ReactiveUI/Activation/CanActivateViewFetcher.cs

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,27 @@ namespace ReactiveUI;
1414
public class CanActivateViewFetcher : IActivationForViewFetcher
1515
{
1616
/// <summary>
17-
/// Returns a positive integer for derived instances of the <see cref="ICanActivate"/> interface.
17+
/// Determines the affinity score for the specified view type based on whether it implements the ICanActivate
18+
/// interface.
1819
/// </summary>
19-
/// <param name="view">The source type to check.</param>
20-
/// <returns>
21-
/// A positive integer if <see cref="GetActivationForView(IActivatableView)"/> is supported,
22-
/// zero otherwise.
23-
/// </returns>
20+
/// <remarks>Use this method to assess whether a view type is suitable for activation scenarios that
21+
/// require the ICanActivate interface. A higher affinity score indicates a stronger match.</remarks>
22+
/// <param name="view">The type of the view to evaluate for activation capability. Cannot be null.</param>
23+
/// <returns>An integer affinity score: 10 if the view type implements ICanActivate; otherwise, 0.</returns>
2424
public int GetAffinityForView(Type view) =>
2525
typeof(ICanActivate).GetTypeInfo().IsAssignableFrom(view.GetTypeInfo()) ? 10 : 0;
2626

2727
/// <summary>
28-
/// Get an observable defining whether the view is active.
28+
/// Returns an observable sequence that indicates the activation state of the specified view.
2929
/// </summary>
30-
/// <param name="view">The view to observe.</param>
31-
/// <returns>An observable tracking whether the view is active.</returns>
30+
/// <remarks>If the provided view does not implement <see cref="ICanActivate"/>, the returned observable
31+
/// emits <see langword="false"/> and completes immediately. Otherwise, the observable reflects the view's
32+
/// activation and deactivation events as they occur.</remarks>
33+
/// <param name="view">The view for which to observe activation and deactivation events. If the view does not support activation, the
34+
/// observable will emit a single value of <see langword="false"/>.</param>
35+
/// <returns>An observable sequence of <see langword="true"/> and <see langword="false"/> values that reflect the activation
36+
/// and deactivation state of the view. The sequence emits <see langword="true"/> when the view is activated and
37+
/// <see langword="false"/> when it is deactivated.</returns>
3238
public IObservable<bool> GetActivationForView(IActivatableView view) =>
3339
view is not ICanActivate canActivate
3440
? Observable.Return(false)

src/ReactiveUI/Activation/ViewForMixins.cs

Lines changed: 112 additions & 92 deletions
Large diffs are not rendered by default.

src/ReactiveUI/Bindings/BindingTypeConverterDispatch.cs

Lines changed: 38 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,19 @@ namespace ReactiveUI;
1111
internal static class BindingTypeConverterDispatch
1212
{
1313
/// <summary>
14-
/// Attempts conversion via the converter's type-only metadata (<see cref="IBindingTypeConverter.FromType"/> and
15-
/// <see cref="IBindingTypeConverter.ToType"/>) and object shim (<see cref="IBindingTypeConverter.TryConvertTyped"/>).
14+
/// Attempts to convert a value to the specified target type using the provided binding type converter.
1615
/// </summary>
17-
/// <param name="converter">The converter.</param>
18-
/// <param name="from">The source value.</param>
19-
/// <param name="toType">The target type requested by the caller.</param>
20-
/// <param name="conversionHint">Implementation-defined hint.</param>
21-
/// <param name="result">The converted result.</param>
22-
/// <returns><see langword="true"/> if conversion succeeded; otherwise <see langword="false"/>.</returns>
16+
/// <remarks>The conversion will only be attempted if the converter's ToType matches the specified toType
17+
/// and the runtime type of from matches the converter's FromType (or is compatible with a nullable value type). No
18+
/// exceptions are thrown for conversion failures; instead, the method returns false.</remarks>
19+
/// <param name="converter">The binding type converter to use for the conversion. Cannot be null.</param>
20+
/// <param name="from">The value to convert. May be null if the target type accepts null values.</param>
21+
/// <param name="toType">The target type to convert the value to. Must match the converter's ToType. Cannot be null.</param>
22+
/// <param name="conversionHint">An optional hint object that may influence the conversion process. The meaning of this parameter is determined
23+
/// by the converter implementation.</param>
24+
/// <param name="result">When this method returns, contains the converted value if the conversion succeeded; otherwise, null. This
25+
/// parameter is passed uninitialized.</param>
26+
/// <returns>true if the value was successfully converted; otherwise, false.</returns>
2327
internal static bool TryConvert(
2428
IBindingTypeConverter converter,
2529
object? from,
@@ -64,15 +68,19 @@ internal static bool TryConvert(
6468
}
6569

6670
/// <summary>
67-
/// Attempts conversion using a fallback converter.
71+
/// Attempts to convert an object to a specified type using the provided fallback converter.
6872
/// </summary>
69-
/// <param name="converter">The fallback converter.</param>
70-
/// <param name="fromType">The source runtime type.</param>
71-
/// <param name="from">The source value (guaranteed non-null by caller).</param>
72-
/// <param name="toType">The target type.</param>
73-
/// <param name="conversionHint">Implementation-defined hint.</param>
74-
/// <param name="result">The converted result.</param>
75-
/// <returns><see langword="true"/> if conversion succeeded; otherwise, <see langword="false"/>.</returns>
73+
/// <remarks>This method delegates the conversion to the specified fallback converter. The result is
74+
/// guaranteed to be non-null only if the conversion succeeds. Callers should check the return value to determine
75+
/// whether the conversion was successful before using the result.</remarks>
76+
/// <param name="converter">The fallback converter to use for the conversion operation. Cannot be null.</param>
77+
/// <param name="fromType">The type of the source object to convert. Used to inform the converter of the input type.</param>
78+
/// <param name="from">The source object to convert. Cannot be null.</param>
79+
/// <param name="toType">The target type to convert the object to. Cannot be null.</param>
80+
/// <param name="conversionHint">An optional hint or context object that may influence the conversion process. May be null.</param>
81+
/// <param name="result">When this method returns, contains the converted object if the conversion succeeded; otherwise, null. This
82+
/// parameter is passed uninitialized.</param>
83+
/// <returns>true if the conversion was successful and the result is non-null; otherwise, false.</returns>
7684
internal static bool TryConvertFallback(
7785
IBindingFallbackConverter converter,
7886
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type fromType,
@@ -103,22 +111,21 @@ internal static bool TryConvertFallback(
103111
}
104112

105113
/// <summary>
106-
/// Unified dispatch method that handles both typed and fallback converters.
114+
/// Attempts to convert an object to a specified target type using the provided converter.
107115
/// </summary>
108-
/// <param name="converter">The converter (either <see cref="IBindingTypeConverter"/> or <see cref="IBindingFallbackConverter"/>).</param>
109-
/// <param name="fromType">The source runtime type.</param>
110-
/// <param name="from">The source value.</param>
111-
/// <param name="toType">The target type.</param>
112-
/// <param name="conversionHint">Implementation-defined hint.</param>
113-
/// <param name="result">The converted result.</param>
114-
/// <returns><see langword="true"/> if conversion succeeded; otherwise, <see langword="false"/>.</returns>
115-
/// <remarks>
116-
/// This method automatically dispatches to the appropriate converter type:
117-
/// <list type="bullet">
118-
/// <item><description><see cref="IBindingTypeConverter"/> - uses exact pair matching</description></item>
119-
/// <item><description><see cref="IBindingFallbackConverter"/> - requires non-null input</description></item>
120-
/// </list>
121-
/// </remarks>
116+
/// <remarks>This method supports both type-based and fallback converters. If the provided converter does
117+
/// not implement a supported interface or is null, the method returns false and result is set to null. The method
118+
/// does not throw exceptions for failed conversions; instead, it returns false to indicate failure.</remarks>
119+
/// <param name="converter">The converter instance to use for the conversion. Must implement either IBindingTypeConverter or
120+
/// IBindingFallbackConverter. If null or of an unsupported type, the conversion will not be performed.</param>
121+
/// <param name="fromType">The type of the source object to convert. Used to determine the appropriate conversion logic.</param>
122+
/// <param name="from">The source object to convert. May be null if the converter supports null values.</param>
123+
/// <param name="toType">The target type to convert the source object to. Cannot be null.</param>
124+
/// <param name="conversionHint">An optional hint or context object that may influence the conversion process. The interpretation of this value
125+
/// depends on the converter implementation.</param>
126+
/// <param name="result">When this method returns, contains the converted value if the conversion succeeded; otherwise, null. This
127+
/// parameter is passed uninitialized.</param>
128+
/// <returns>true if the conversion was successful and result contains the converted value; otherwise, false.</returns>
122129
internal static bool TryConvertAny(
123130
object? converter,
124131
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type fromType,

0 commit comments

Comments
 (0)