Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

newValue argument as Ref for *Changing() generated methods

オープン
#1,054 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
csharp
領域
tooling

調査の方向性

ObservableProperty のソース生成エントリポイントから開始し、Issue に示されている ref と non-ref のシグネチャを含め、*Changing methods がどのように生成されるかを確認します。生成された API が代入前の newValue の変更をサポートしていることを検証し、存在する場合は既存のジェネレーターテストまたは生成出力の fixture を確認します。既存のメソッドを壊すことなく、使用例で生成された ref オーバーロードを通じて WindowTitle を前置できれば完了です。

索引モデルが issue の本文から書いたものです。

説明

feature request :mailbox_with_mail:
Overview

Hi, I'm migrating some old C# ViewModel code to use the [ObservableProperty] attribute on all the properties.

I'd like to convert the following code:

private string _windowTitle;
public string WindowTitle {
  get {
    return _windowTitle;
  }
  set {
    _windowTitle = $ "Window title prefix: {value}";
    OnPropertyChanged(nameof(WindowTitle));
  }
}

...but I couldn't find any "simple" or "standard" method to accomplish the same behavior using the MVVM Toolkit.

I discovered that recently the methods *Changing(string? newValue) or *Changing(string? oldValue, string newValue) got added, but the newValue isn't passed as ref string, so I can't intercept and change the value.

Could this prototype be implemented for those methods? Thanks!

API breakdown
partial void OnWindowTitleChanging(ref string value);
partial void OnWindowTitleChanging(string? oldValue, ref string newValue);
Usage example
partial void OnWindowTitleChanging(string? oldValue, ref string newValue)
{
    newValue = "Window title prefix: " + newValue;
}
Breaking change?

I'm not sure

Alternatives
Additional context

No response

Help us help you

No, just wanted to propose this

主要言語
C#
スター
3.8k
フォーク
401
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

CommunityToolkit/dotnet のほかの issue

CommunityToolkit/dotnet の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。