vendredi 9 avril 2021

Action method in c#

I just want him to give me what has changed at the entrance. When I want to get the same value to the input of the select method, I want to get the same values in the action output, not the whole properties class WeatherForecast.

 public class WeatherForecast
{
    public DateTime Date { get; set; }
    public int TemperatureC { get; set; }
    public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
    public string Summary { get; set; }
}


 public void method(){
        Select(d=>
        {
            d.Summary = "dasd";
            d.TemperatureC = 25;
        });}

 private void Select(Action<WeatherForecast> func)
    {
        var result = new WeatherForecast();
     
        func(result);
        foreach (var item in result.GetType().GetProperties())
        {
            RaisePropertyChanged(item.Name);
        }
        var ss = func;
        
    }

'''





Aucun commentaire:

Enregistrer un commentaire