Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to test console application
Message
De
24/09/2008 00:44:13
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 3.0
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01349592
Message ID:
01350104
Vues:
21
This message has been marked as a message which has helped to the initial question of the thread.
It also states that the purpose of the program is to find all occurrences, yet it only finds the first.

Did you "pass" the interview?

~~Bonnie



>Hi everybody,
>
>This is actually sort of an initial interview question. I have this program
>
>using System;
>
>namespace CreditSights
>{
>    /// <summary>
>    /// The purpose of this program is to read in a file and search for all
>    /// occurrences of the string passed in. 
>    /// 
>    /// e.g. SearchForText.exe autonomous resume.txt
>    /// e.g. SearchForText.exe smart resume.txt
>    /// </summary>
>    class SearchForText
>    {
>        static void Main(string[] args)
>        {
>            string toFind = args[1];
>            string file = args[2];
>
>            string text = System.IO.File.OpenText(file).ReadToEnd();
>
>            Console.WriteLine("Found it at: " + text.IndexOf(toFind));
>        }
>    }
>}
>
>And I need to figure out what is wrong with it. I created a new Console application but then I try to debug it I obviously get an error. So, my question is how to test it.
>
>Also in terms of what is wrong here I guess no error checking is the first thing that is wrong. But what else is wrong?
>
>Thanks in advance.
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform