-1
string id = oUser.id.ToString();
 Image1.ImageUrl="http://graph.facebook.com/893914824028397/picture?type=large&redirect=true&width=500&height=500";

I want to replace 893914824028397 by string id

melya
  • 578
  • 5
  • 24
Abhendra Tiwari
  • 23
  • 1
  • 11
  • 5
    so... I hate to say this, but... what have you tried? there are a myriad of ways to do this - concatenation, replace, string.format, C# string interpolation, etc – Marc Gravell Nov 21 '17 at 10:43
  • Welcome to Stack Overflow. Please read [ask] and share your research. Searching the web for "C# replace variable in string" yields hundreds of thousands of results, there's absolutely no need to ask that question again. If you did find something but it didn't work, then [edit] your question to include that, and explain what it does or doesn't do. – CodeCaster Nov 21 '17 at 11:23

1 Answers1

0

You can use String Interpolation feature from C#6, so your code will look like:

string id = oUser.id.ToString();
Image1.ImageUrl=$"http://graph.facebook.com/{id}/picture?type=large&redirect=true&width=500&height=500";
ilya korover
  • 230
  • 1
  • 3