Skip to content

Cleanup: instance-style extension calls, redundant generic args, and redundant casts#12583

Open
ivandrofly wants to merge 3 commits into
SubtitleEdit:mainfrom
ivandrofly:refactor/extension-method-call-style
Open

Cleanup: instance-style extension calls, redundant generic args, and redundant casts#12583
ivandrofly wants to merge 3 commits into
SubtitleEdit:mainfrom
ivandrofly:refactor/extension-method-call-style

Conversation

@ivandrofly

@ivandrofly ivandrofly commented Jul 17, 2026

Copy link
Copy Markdown
Member

Three small, behavior-preserving cleanup commits:

  1. Drop redundant <string> type argument from MakeComboBox calls — the generic type is inferred from the source collection, so the explicit <string> was just noise. Touches the DCinema SMPTE, iTunes Timed Text, Timed Text 1.0, IMSC 1.1 property windows, and the Cut Video window.

  2. Use instance-style extension method calls — convert static extension-method invocations to instance call syntax: LINQ (Enumerable.FirstOrDefault/Count/ToList), ObservableCollectionExtensions.AddRange, ClipboardExtensions.TryGetTextAsync, UiUtil.RemoveControlFromParent, and SplitToLines.

  3. Remove redundant and unnecessary casts — drop casts the compiler already supplies or that are no-ops: redundant numeric casts around Math.Round/division/TimeSpan.FromSeconds (integer-division semantics preserved), pointless (uint)/(int)/(byte) casts on already-correct types, leftover (IEnumerable<T>) upcasts before LINQ instance calls, and superfluous nullable/reference casts on ternary branches.

No behavior change. Full solution builds clean.

🤖 Generated with Claude Code

ivandrofly and others added 3 commits July 17, 2026 19:28
The generic type is inferred from the source collection, so the explicit
<string> is unnecessary noise.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Convert static extension-method invocations to instance call syntax:
LINQ (Enumerable.FirstOrDefault/Count/ToList), ObservableCollectionExtensions.AddRange,
ClipboardExtensions.TryGetTextAsync, UiUtil.RemoveControlFromParent, and SplitToLines.
More readable and idiomatic; no behavior change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Drop casts that the compiler already provides implicitly or that are no-ops:
- redundant numeric casts around Math.Round / division / TimeSpan.FromSeconds
  where the operand or result type already matches (integer division semantics
  in AdvancedEffectAudioTextPulse are preserved);
- pointless (uint)/(int)/(byte) casts on already-correct types;
- (IEnumerable<T>) upcasts left over before LINQ instance calls;
- superfluous nullable/reference casts on ternary branches (e.g. : (T?)null).

No behavior change; full solution builds clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ivandrofly ivandrofly changed the title Cleanup: use instance-style extension method calls and drop redundant generic args Cleanup: instance-style extension calls, redundant generic args, and redundant casts Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant