How to return a value using constructor in c#?

后端 未结 6 944
温柔的废话
温柔的废话 2021-01-04 03:42

I follow a convention that I won\'t use any print statements in classes, but I have done a parameter validation in a constructor. Please tell me how to return that validatio

6条回答
  •  Happy的楠姐
    2021-01-04 03:51

    Make a Constructor with Out parameter and send your return value via same.

    public class ClassA
    {
        public ClassA(out bool success)
        {
            success = true;
        }
    }
    

提交回复
热议问题