Various Scripts and Application Code Segments for .NET, VB, C#, C++, C, Java, JavaScript, HTML, Python, Perl, AutoIT, Batch, ASP Classic, Objective-C, Swift, Unreal Engine 4, Unity3D & others. Also contains numerous IT tidbits, procedures, and tricks including Technology Hacks on various platforms.
Showing posts with label case statement in C#. Show all posts
Showing posts with label case statement in C#. Show all posts
Tuesday, December 14, 2010
Using Switch/Case statement in ASP.NET C#
I know this is pretty rudimentary in programming concepts, but the switch/case statement is quite important. In case you don't know how to utilize this, here is the reference. I used this statement in my MobileExec for finding diskspace available. See above screenshot.
switch (lengthdiff)
{
case 0:
Label1.Text += "<b>Free space: </b>" + freespace2.ToString("N0") +
" GB;";
break;
case 1:
Label1.Text += "<b>Free space: </b>" + freespace2.ToString("N0")
+ " GB;";
break;
case 2:
Label1.Text += "<b>Free space: </b>" + freespace2.ToString("N0")
+ " GB;";
break;
case 3:
Label1.Text += "<b>Free space: <.b>" + freespace2.ToString("N0")
+ " GB;";
break;
default:
Label1.Text += "<b>Free space: </b>" + freespace2.ToString("N0")
+ " GB;";
break;
}
Subscribe to:
Posts (Atom)
Generating "Always On Top" NSWindow in macOS across all detected displays
Also: Using UIKit & Cocoa Frameworks using Objective-C In m acOS or OS X , written in either Objective-C or Swift Langues, you m...