Click here to Skip to main content
15,888,351 members
Home / Discussions / C#
   

C#

 
GeneralRe: how to connect MySql via network Pin
Erdinc2722-Sep-10 22:35
Erdinc2722-Sep-10 22:35 
GeneralRe: how to connect MySql via network Pin
Simon_Whale22-Sep-10 22:41
Simon_Whale22-Sep-10 22:41 
GeneralRe: how to connect MySql via network Pin
Erdinc2722-Sep-10 22:56
Erdinc2722-Sep-10 22:56 
AnswerRe: how to connect MySql via network Pin
Saksida Bojan23-Sep-10 0:45
Saksida Bojan23-Sep-10 0:45 
GeneralRe: how to connect MySql via network Pin
Erdinc2723-Sep-10 1:46
Erdinc2723-Sep-10 1:46 
QuestionIcon for dll assembly Pin
Chesnokov Yuriy22-Sep-10 19:13
professionalChesnokov Yuriy22-Sep-10 19:13 
AnswerRe: Icon for dll assembly Pin
AspDotNetDev22-Sep-10 19:34
protectorAspDotNetDev22-Sep-10 19:34 
QuestionQuick C# Help Retrieve data using while (!sr.EndOfStream) Pin
d87c22-Sep-10 17:35
d87c22-Sep-10 17:35 
I ran into problem for my school assignment and it is to display whatever in a meal.csv file, here is a code we are starting with. The array string of itemDetails is where the data is store then passed into array ReadLines, then in Main, it is passed to mealContent, but when I tried Console.WriteLine(mealContent); it only prompted System.String[]. So how do I at least display it out in the command prompt. Thanks for the help guys~ Source code is also attached

Code/meal.csv
lunch,bento box b - sashimi,box combo,$9.59
dinner,vegetable sushi,6 rolls,$3.50
dinner,tuna roll,3 rolls,$4.50
dinner,roe, 2 rolls,$3.95
lunch,bento box a - chicken teriyaki,box combo,$8.59

lunch,bento box b - sashimi,box combo,$9.59 dinner,vegetable sushi,6 rolls,$3.50 dinner,tuna roll,3 rolls,$4.50 dinner,roe, 2 rolls,$3.95 lunch,bento box a - chicken teriyaki,box combo,$8.59
FileIOManager/FileLocation.cs

using System;

namespace FileIOManager
{
static class FileLocation
{
public const string INPUT_FILE = "../../Data/meals.csv";
}
}

using System; namespace FileIOManager { static class FileLocation { public const string INPUT_FILE = "../../Data/meals.csv"; } }
FileIOManager/FileReader.cs

using System;
using System.IO;

namespace FileIOManager
{
static public class FileReader
{
private static int GetLineCount()
{
StreamReader sr = new StreamReader(FileLocation.INPUT_FILE);
int counter = 0;
while (!sr.EndOfStream)
{
counter++;
sr.ReadLine();
}
sr.Close();
return counter;
}


public static string[] ReadLines()

{

int totalItems = GetLineCount();

string[] itemDetails = new string[totalItems];

StreamReader sr = new StreamReader(FileLocation.INPUT_FILE);



string itemDetail;

int counter = 0;



while (!sr.EndOfStream){

itemDetail = sr.ReadLine();

if (itemDetail.Trim() != "")

itemDetails[counter++] = itemDetail;

}

sr.Close();

return itemDetails;

}

}
} Cry | :((
AnswerRe: Quick C# Help Retrieve data using while (!sr.EndOfStream) Pin
AspDotNetDev22-Sep-10 18:58
protectorAspDotNetDev22-Sep-10 18:58 
GeneralRe: Quick C# Help Retrieve data using while (!sr.EndOfStream) Pin
d87c22-Sep-10 19:05
d87c22-Sep-10 19:05 
GeneralRe: Quick C# Help Retrieve data using while (!sr.EndOfStream) Pin
AspDotNetDev22-Sep-10 19:17
protectorAspDotNetDev22-Sep-10 19:17 
QuestionRetrieve array items to use in NUnit Test Pin
mtn*rain22-Sep-10 15:01
mtn*rain22-Sep-10 15:01 
AnswerRe: Retrieve array items to use in NUnit Test Pin
Luc Pattyn22-Sep-10 15:37
sitebuilderLuc Pattyn22-Sep-10 15:37 
GeneralRe: Retrieve array items to use in NUnit Test Pin
mtn*rain22-Sep-10 15:39
mtn*rain22-Sep-10 15:39 
AnswerRe: Retrieve array items to use in NUnit Test Pin
Luc Pattyn22-Sep-10 15:44
sitebuilderLuc Pattyn22-Sep-10 15:44 
GeneralRe: Retrieve array items to use in NUnit Test Pin
mtn*rain22-Sep-10 15:48
mtn*rain22-Sep-10 15:48 
GeneralRe: Retrieve array items to use in NUnit Test Pin
Luc Pattyn22-Sep-10 15:59
sitebuilderLuc Pattyn22-Sep-10 15:59 
GeneralRe: Retrieve array items to use in NUnit Test Pin
mtn*rain22-Sep-10 16:02
mtn*rain22-Sep-10 16:02 
AnswerRe: Retrieve array items to use in NUnit Test Pin
AspDotNetDev22-Sep-10 16:07
protectorAspDotNetDev22-Sep-10 16:07 
GeneralRe: Retrieve array items to use in NUnit Test Pin
mtn*rain22-Sep-10 16:12
mtn*rain22-Sep-10 16:12 
GeneralRe: Retrieve array items to use in NUnit Test Pin
Paul Michalik22-Sep-10 20:47
Paul Michalik22-Sep-10 20:47 
Question3 way byte merge Pin
jkohler22-Sep-10 4:01
jkohler22-Sep-10 4:01 
AnswerRe: 3 way byte merge Pin
OriginalGriff22-Sep-10 4:19
mveOriginalGriff22-Sep-10 4:19 
GeneralRe: 3 way byte merge Pin
jkohler22-Sep-10 4:28
jkohler22-Sep-10 4:28 
AnswerRe: 3 way byte merge Pin
Ennis Ray Lynch, Jr.22-Sep-10 5:07
Ennis Ray Lynch, Jr.22-Sep-10 5:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.