Cysharp / Cysharp/ObservableCollections

Data parameter in CreateView

Open
#117 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
1k
Forks
73
Avg merge
5d 4h
Merged PRs (30d)
2

Description

Is there any reason to not have an overload with the data parameter for CreateView?

With the current signature:
ISynchronizedView<T, TView> CreateView<TView>(Func<T, TView> transform);
viewFactory is captured:

_synchronizedView = myModel.Items
    .CreateView(item => {
        return viewFactory.Create(item);
    });

While this way
ISynchronizedView<T, TView> CreateView<TData, TView>(TData data, Func<T, TData, TView> transform);
it isn't, and the lambda can be made static:

_synchronizedView = myModel.Items
    .CreateView(viewFactory, static (item, viewFactory) => {
        return viewFactory.Create(item);
    });

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the existing CreateView(Func<T, TView>) entry point and compare its captured viewFactory usage with the proposed data-parameter form. Done means callers can pass viewFactory as data and use the static transform shown in the issue, without changing the existing form.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.