I have this code:
string str1 = "Button1";
string str2 = "Button2";
string str3 = str1 + " " + str2;
What I want is to copy the text from str3
("Button1 Button2"
) so that
string str4 = "Button1 Button2";
Why do I want such a thing, you may ask? It's because of this method that I'm trying to develop:
public void SearchNumpadNumbersOnMyApp(double valueRepoItemName)
{
valueRepoItemName = Math.Abs(valueRepoItemName);
string repoItemName;
string result = string.Format("{0:F1}", valueRepoItemName);
int length = result.Length;
char[] arrayOfCharacters = result.ToCharArray();
for (int i = 0; i < length; i++)
{
repoItemName = "Button" + arrayOfCharacters[i].ToString();
// Query RepoItemInfo objects based on the repository item name
IEnumerable<RepoItemInfo> myQuery = from things in repo.FO.FLOW2FO.Container2.SelfInfo.Children
where ReferenceEquals(things.Name, repoItemName)
select things;
// Create "unkown" adapter for the first found element and click it
myQuery.First().CreateAdapter<Unknown>(true).Click();
}
}
When I pass repoItemName
to
where ReferenceEquals(things.Name, repoItemName)
I get the error message "Sequence contains no elements"
, and this occurs when I try to pass repoItemName
string. This is the same as passing
where ReferenceEquals(things.Name, "Button" + arrayOfCharacters[i].ToString())
and this is the reason why I'm getting the error. So, what I want is to pass the actual text of the string and not its reference. I want it to be, for example, like this:
where ReferenceEquals(things.Name, "Button5")
Being "Button5" the string structure built with:
repoItemName = "Button" + arrayOfCharacters[i].ToString();
By the way, I already tried:
String.Copy();
String.Clone();
but nothing seems to do what I really want.