You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 8e8be8e
Browse filesBrowse the repository at this point in the historyBrowse files
AddParams(x) now sends the members of the runtime type when x is typed object (#90)
A variable typed object, or the result of a Func<T, object>, used to send
nothing because it has no members of its own. AddParams now uses the members of
the object's runtime type, found once per type and remembered.
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: Source/Core/ExpressiveCommandBase.cs
+17-1Lines changed: 17 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -379,7 +379,8 @@ public TThis AddParamIf<T>(bool condition, T value, [CallerArgumentExpression(na
379
379
/// When the real names are known, a member that the procedure does not declare is not sent, so one object can serve several procedures; parameters the procedure declares that no member matches are left to default values or to explicit <c>AddParam</c> calls.
380
380
/// A parameter you add with <c>AddParam</c>, by name or from an argument, wins over a member that resolves to the same name.</para>
381
381
/// <para>Every public readable property and field is read when this method is called, whether or not the procedure declares it, so a getter that throws or loads lazily runs then. Static members and indexers are ignored.
382
-
/// The members are those of the static type <typeparamref name="T"/>, not of the object's runtime type: a variable typed <see cref="object"/> has no members and adds nothing, and an interface adds only its own. Nested objects are not flattened (pass <c>order.Customer</c> itself).</para>
382
+
/// The members are those of the static type <typeparamref name="T"/>, not of the object's runtime type: an interface adds only its own. The one exception is <see cref="object"/>: a variable typed <see cref="object"/>, or the result of a <c>Func<T, object></c>, has no members of its own, so the members of its runtime type are used.
383
+
/// There, the members of each type are found once and remembered. Nested objects are not flattened (pass <c>order.Customer</c> itself).</para>
383
384
/// </remarks>
384
385
/// <typeparam name="T">The type of the object whose members are the parameters.</typeparam>
385
386
/// <param name="source">The object to read the values from.</param>
@@ -391,6 +392,21 @@ public TThis AddParams<T>(T source)
/// The public instance properties and fields of a RUNTIME type and a compiled getter for each, built once per type, for <c>AddParams(object)</c> when the argument is typed <see cref="object"/>
7
+
/// and the static type has no members of its own. The members are found the way <see cref="ParamSource{T}"/> finds them.
8
+
/// </summary>
9
+
/// <remarks>One immutable entry per type, kept for as long as the type is alive (so a type that is unloaded takes its entry with it); the getters take the object, so no reflection runs after the first time a type is seen.</remarks>
0 commit comments