Return multiple values from a class to method

前端 未结 1 1259
滥情空心
滥情空心 2021-01-07 01:28

I have a method passing a string to a class. For testing reasons I have used a button for now. I have searched in the forum for similar questions but they refer to php and o

相关标签:
1条回答
  • 2021-01-07 02:01

    I think create class is better in this case

       public class MyClass
        {
            public string Corrente { get; set; }
            public string Temperatura { get; set; }
            public string NumGiri { get; set; }
        }
    

    then

    public MyClass Distri(string inArrivo)
    {
        // your code
    
        MyClass myclass = new MyClass() {
            Corrente = corrente, 
            NumGiri = numGiri, 
            Temperatura = temperatura 
        };
        return myclass;
    
    }
    

    this is how you can call

    Stripper strp = new Stripper();
    MyClass myclass = strp.Distri(invia);
    

    // access values as below

    textBox7.Text = myclass.NumGiri;
    
    0 讨论(0)
提交回复
热议问题