Click here to Skip to main content
15,911,139 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
string x = "My String"; 
x = x + required_expression;
return x;  

and
C#
string x = "My String"; 
x += required_expression; 
return x;  


You need to tell what required_expression should be!
Posted
Updated 3-Aug-16 22:48pm
v2
Comments
Anisuzzaman Sumon 4-Aug-16 1:31am    
You can use
string x = "Anis";
x+="|"+Guid.NewGuid().ToString();

that will return each time different value of x.
Maciej Los 4-Aug-16 2:00am    
Post it as an answer and i promise to upvote it.
Anisuzzaman Sumon 4-Aug-16 4:49am    
done as you say :) it's your turn

You need to get a good book on C# and study the basics. You need to learn what a method is, what a method's parameters are, and the difference between a method that returns some-value, and one that does not return a value.

In this QA answer: [^] you'll find links to two free books on C#, and general advice on how to study the language.

You are wasting your time posting a question as general as this one, and, if this is homework, providing an answer for you would not help you really ... learn.
 
Share this answer
 
Comments
Maciej Los 4-Aug-16 2:01am    
5ed!
Start learning by reading a book is alwas good alternative.
Learning_to_code wrote:

You need to tell what required_expression should be!


No! We can, but we don't have to...

I'd suggest to read the rules[^]. The rule no. 8 states:

Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.



Conclusion: this is your job.

Tip: Anisuzzaman Sumon[^] has posted an answer to your question in the comment to the question.
 
Share this answer
 
You can use
C#
string x = "Anis";
x+="|"+Guid.NewGuid().ToString();

that will return each time different value of x.
 
Share this answer
 
Comments
Maciej Los 4-Aug-16 9:15am    
5ed!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900