The out parameter 'parametername' must be assigned to before control leaves

The out parameter 'parametername' must be assigned to before control leaves


You get this error message when you use the "out" parameter using the out keyword. 

Learn more about out and ref parameters.


Resolution

To resolve this error, you must assign a value to the out parameter within the method. If the out parameter is used within a loop or statement, it must be used outside of that loop and must have a value assigned to it.