'Using value returned by a method as input parameter in C#
I have a method returnNo in C# that returns a string as shown below.
public string RecordNo()
{
//Get the string of the Record No from the page
string recordSavedNumber = recordNoForRecord.Text.Replace("- Record #", "");
return recordSavedNumber;
}
I also want to use the recordSavedNumber returned by the method above as input parameter in a searchMethod show below
public void searchRecord(string recordNum){
// do something
}
Can someone please assist how I can do that?
Solution 1:[1]
Like this
var num = RecordNo();
searchRecord(num);
or like this:
searchRecord(RecordNo());
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Joel Coehoorn |
