NewsBot
1
I am writting a console application in C# (actually my first C# app)*and I want to clean up/simplify my code:
this*is part of what i am dealing with*what I currently have
****** Operating System Windows_NT********************************************************************************
** Number of Processors 4*****************************************************************************************
Basically I want to make a class called Format Interface that will simplify the creation of the above.* This is what I have so far but I can't seem to get spaces to format right
*** public class FinishInterface
*** {
******* public string text;
******* public string varName;
******* public FinishInterface(string text, string varName)
******* {
*********** this.text = text;
*********** this.varName = varName;
******* }
******* public void TheRest()
******* {
*********** Console.Write("****** Operating System ");
*********** Console.Write(text);
*********** int varName = 0;
*********** do { Console.Write(" "); varName++; }
*********** while (varName < 91 - text.Length);
*********** Console.Write("");
*********** Console.WriteLine("");
******* }
*** }
Then I would call it with
FinishInterface FI = new FinishInterface(Environment.GetEnvironmentVariable("OS"), "OS");
FI.TheRest();
Any suggestions?
More...
View All Our Microsoft Related Feeds
this*is part of what i am dealing with*what I currently have
Console.WriteLine("");
// ****************************************
// OS
// ****************************************
*** string strOS = Environment.GetEnvironmentVariable("OS");
*** Console.Write("****** Operating System ");
*** Console.Write(Environment.GetEnvironmentVariable("OS"));
*** int OS = 0;
*** do { Console.Write(" "); OS++; }
*** while (OS < 91 - strOS.Length);
*** Console.Write("");
*** Console.WriteLine("");
// ****************************************
// NUMBER_OF_PROCESSORS
// ****************************************
*** string strNUMBER_OF_PROCESSORS = Environment.GetEnvironmentVariable("NUMBER_OF_PROCESSORS");
*** Console.Write("** Number of Processors ");
*** Console.Write(Environment.GetEnvironmentVariable("NUMBER_OF_PROCESSORS"));
*** int NUMBER_OF_PROCESSORS = 0;
*** do { Console.Write(" "); NUMBER_OF_PROCESSORS++; }
*** while (NUMBER_OF_PROCESSORS < 91 - strNUMBER_OF_PROCESSORS.Length);
*** Console.Write("");
*** Console.WriteLine("");
// ****************************************
// BACK TO THE REST
Console.WriteLine("");
Console.WriteLine("");
Console.ResetColor();
That displays// ****************************************
// OS
// ****************************************
*** string strOS = Environment.GetEnvironmentVariable("OS");
*** Console.Write("****** Operating System ");
*** Console.Write(Environment.GetEnvironmentVariable("OS"));
*** int OS = 0;
*** do { Console.Write(" "); OS++; }
*** while (OS < 91 - strOS.Length);
*** Console.Write("");
*** Console.WriteLine("");
// ****************************************
// NUMBER_OF_PROCESSORS
// ****************************************
*** string strNUMBER_OF_PROCESSORS = Environment.GetEnvironmentVariable("NUMBER_OF_PROCESSORS");
*** Console.Write("** Number of Processors ");
*** Console.Write(Environment.GetEnvironmentVariable("NUMBER_OF_PROCESSORS"));
*** int NUMBER_OF_PROCESSORS = 0;
*** do { Console.Write(" "); NUMBER_OF_PROCESSORS++; }
*** while (NUMBER_OF_PROCESSORS < 91 - strNUMBER_OF_PROCESSORS.Length);
*** Console.Write("");
*** Console.WriteLine("");
// ****************************************
// BACK TO THE REST
Console.WriteLine("");
Console.WriteLine("");
Console.ResetColor();
****** Operating System Windows_NT********************************************************************************
** Number of Processors 4*****************************************************************************************
Basically I want to make a class called Format Interface that will simplify the creation of the above.* This is what I have so far but I can't seem to get spaces to format right
*** public class FinishInterface
*** {
******* public string text;
******* public string varName;
******* public FinishInterface(string text, string varName)
******* {
*********** this.text = text;
*********** this.varName = varName;
******* }
******* public void TheRest()
******* {
*********** Console.Write("****** Operating System ");
*********** Console.Write(text);
*********** int varName = 0;
*********** do { Console.Write(" "); varName++; }
*********** while (varName < 91 - text.Length);
*********** Console.Write("");
*********** Console.WriteLine("");
******* }
*** }
Then I would call it with
FinishInterface FI = new FinishInterface(Environment.GetEnvironmentVariable("OS"), "OS");
FI.TheRest();
Any suggestions?
More...
View All Our Microsoft Related Feeds