I have a class and method in this class. However, this class method returns a string. When I call the class method, I do not receive an error message, even if I do not receive the return string value. Is there a way I can do C # and .net make me grab the value when returning the value. Here is an example of what I mean.
1- create a class test.
class test { public string mystring() { return "BLAH"; } }
2- call a class method from a program or another class
test mystring = new test(); mystring.mystring();
My compiler, while working in Visual Studio, does not complain that I am not collecting the return value. Is this normal or am I missing something. Can I get the compiler to notify me that the function is returning a value, but I am not catching it?
Thanks in advance for any suggestions you may have.
source share