using if,else inside a string

It is containing all topics related to Visual Basic, .NET Framework, Web Resource, GDI etc.
Posts: 435
Joined: Sat Aug 23, 2014 5:34 pm

using if,else inside a string

Postby ramverma » Tue Oct 13, 2015 7:18 am

I'm trying to arrange a string with conditional sections which seems to be incorrect. Just looking for the right way.

var string = "";
var int = 2;
string ="the var int mentioned here" + if(int == 2){"equals 2"}else{"doesn't equal 2"}

any idea to do it the right way without having to right the whole string again for each situation?


Return to “Visual Basic .NET and ASP.NET”

Who is online

Users browsing this forum: No registered users and 1 guest