Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //http://thedailywtf.com/Articles/The-Percent-Conversion.aspx
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace TDWTF_Percent_Conversion
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Public ReadOnly Property BatteryPercent()");
- Console.WriteLine("' This code will retrieve the BatteryLifePercent property and convert it to a percent.");
- Console.WriteLine("Get");
- for (float i = 100; i > 0; i--)
- {
- Console.WriteLine("{0}If SystemInformation.PowerStatus.BatteryLifePercent.ToString = \"{1}\" Then", i != 100 ? "Else" : "", i / 100);
- Console.WriteLine("Return \"{0}%\"", i);
- }
- Console.WriteLine("Else");
- Console.WriteLine("Return \"NA\"");
- Console.WriteLine("End If");
- Console.WriteLine("End Get");
- Console.WriteLine("End Property");
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment