console-application

how to call “ static void Main(string[] args) ”in the class again

走远了吗. 提交于 2019-12-02 03:47:32
i am new in C# and working on Console Applications now a days i wrote the following code : Program.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Ch06Ex01 { class Program { static void Write() { Console.WriteLine("Please enter any string..!!"); } static void Main(string[] args) { Write(); string name = Console.ReadLine(); Write(); string name1 = Console.ReadLine(); Write(); string name2 = Console.ReadLine(); Write(); string name3 = Console.ReadLine(); Console.WriteLine("{0}, {1}, {2}, {3}",name,name1,name2,name3)

“System.FormatException” when getting user input from console - visual c#

瘦欲@ 提交于 2019-12-02 02:24:15
问题 I am trying to make a command line program that will ask if fast and long you want it to beep. I keep getting System.FormatException on the code below. I get the problem right after Console.WriteLine("how many times should i beep?"); . I've found a fix by putting a console.read();//pause right after this line. My question is what am I doing wrong? or am I suppose to have the pause after that line? using System; using System.Collections.Generic; using System.Linq; using System.Text; using

Should I go with static methods or non static methods?

烈酒焚心 提交于 2019-12-02 01:39:48
问题 I have created a console application in C# and there is main method (static) and my requirement is to initialize 2 timers and handles 2 methods respectively which will be called periodically to do some task. Now I have taken all other methods/variables static because that are calling from timer handler events (which are static due to calling it from main). Now i would like to know for above scenario how memory is going to be consumed if this console running for long time? if i would like to

.NET Core 2 Console App Dependencies Issue on Azure

北慕城南 提交于 2019-12-02 00:55:34
Short version of the problem: I'm having difficulties including the assemblies my .NET Core Console App depends on. Initially, the assemblies from NuGet packages were not included in the bin folder even though I could run the app in Debug mode without any problems. Found an article that suggested that I should add <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> in the myapp.csproj file which I did. Doing so included the dll files for the NuGet packages in the bin folder BUT after I copied my console app to Azure to run as a WebJob, I got an error telling me that System.Data

How to iterate through a column in an Excel application through C# Console?

人盡茶涼 提交于 2019-12-02 00:33:22
I have created a Console Application that reads from an Excel file. I want to take all of the document numbers and place it in an array for searching purposes. I am able to find the cell that contains the data "DocumentNumber" e.g. $F$5. How can I iterate through rows within column F? I have the following code: public static void Main(string[] args) { string address; string next; try { Excel.ApplicationClass excel = new Excel.ApplicationClass(); Excel.Workbook workbook = excel.Workbooks.Open(@"D:\sample.xls", Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing

Non-blocking read of stdin?

混江龙づ霸主 提交于 2019-12-02 00:27:45
I need to have my form-based application check stdin periodically for input, but still perform other processing. Scripting.TextStream.Read() and the ReadFile() API are blocking, is there a non-blocking method of reading stdin in VB6? With Timer1 set to fire every 100 ms, I've tried: Private Declare Function AllocConsole Lib "kernel32" () As Long Private Declare Function FreeConsole Lib "kernel32" () As Long Dim sin As Scripting.TextStream Private Sub Form_Load() AllocConsole Dim FSO As New Scripting.FileSystemObject Set sin = FSO.GetStandardStream(StdIn) Timer1.Enabled = True End Sub Private

What happened to the context menu in my console application?

本秂侑毒 提交于 2019-12-02 00:23:15
Was creating a simple console application to do some prototyping and was shocked to see that the right-click/context menu is missing from a standard .NET console app! I'm unable to find any information about this, and intellisense isn't helping. So what happened to it? Can I get it back? And if not, how can I configure my console application to treat ctrl-c/ctrl-v as standard? Context menu doesn't show up when you right click on the console app body (not the title bar) when VS debugger is attached. This is a windows console settings thing. Right click on the task bar of the app, click

Should I go with static methods or non static methods?

那年仲夏 提交于 2019-12-01 22:59:39
I have created a console application in C# and there is main method (static) and my requirement is to initialize 2 timers and handles 2 methods respectively which will be called periodically to do some task. Now I have taken all other methods/variables static because that are calling from timer handler events (which are static due to calling it from main). Now i would like to know for above scenario how memory is going to be consumed if this console running for long time? if i would like to apply oops concept then do i need make all methods/variables non static and access that by creating

Monodevelop on Ubuntu Console.ReadLine doesn't work

旧城冷巷雨未停 提交于 2019-12-01 22:18:48
问题 I'm trying to develop on Mono platform on Ubuntu. But I got trouble on my first application :) Here is the code: using System; using System.Threading; namespace threadings { class MainClass { public static void Main (string[] args) { Console.WriteLine ("The start"); string x=Console.ReadLine(); Console.WriteLine(x); Console.WriteLine ("the end"); } } } And here is the result: The start the end And no any string between them, and no reading from console happens, and I can't input anything.

Unresolved external symbol _declspec(dllimport)

巧了我就是萌 提交于 2019-12-01 21:38:42
I've created an DLL for my Console Application in Visual Studio. In my DLL I have a Class named Dialog_MainMenu with has a *.cpp file and a *.h file. Following error message : Error 9 error LNK2001: unresolved external symbol "__declspec(dllimport) public: static enum Dialog_MainMenu::GAME_STATES Dialog_MainMenu::CurrentGameState" (_ imp ?CurrentGameState@Dialog_MainMenu@@2W4GAME_STATES@1@A) C:\Users\Kevin\Desktop\c++ projects\development_testing\The Intense Adventure\Dialogs\Dialog_MainMenu.obj Dialogs Which I kinda don't understand. This only occured when I added an enum to my prototype in