Click here to Skip to main content
15,561,125 members
Home / Discussions / C#
   

C#

 
GeneralRe: Weird problem with Custom StreamReader with Read override not reading correct number of bytes during base method call Pin
pr1mem0ver16-Nov-20 15:58
pr1mem0ver16-Nov-20 15:58 
AnswerRe: Weird problem with Custom StreamReader with Read override not reading correct number of bytes during base method call Pin
OriginalGriff8-Nov-20 2:35
mveOriginalGriff8-Nov-20 2:35 
GeneralRe: Weird problem with Custom StreamReader with Read override not reading correct number of bytes during base method call Pin
pr1mem0ver16-Nov-20 16:10
pr1mem0ver16-Nov-20 16:10 
AnswerRe: Weird problem with Custom StreamReader with Read override not reading correct number of bytes during base method call Pin
Richard Deeming8-Nov-20 22:39
mveRichard Deeming8-Nov-20 22:39 
GeneralRe: Weird problem with Custom StreamReader with Read override not reading correct number of bytes during base method call Pin
pr1mem0ver16-Nov-20 16:06
pr1mem0ver16-Nov-20 16:06 
QuestionSystem.IO.File.WriteAllLines exception Pin
_Flaviu6-Nov-20 0:52
_Flaviu6-Nov-20 0:52 
AnswerRe: System.IO.File.WriteAllLines exception Pin
Richard MacCutchan6-Nov-20 1:01
mveRichard MacCutchan6-Nov-20 1:01 
AnswerRe: System.IO.File.WriteAllLines exception Pin
OriginalGriff6-Nov-20 1:18
mveOriginalGriff6-Nov-20 1:18 
What do you expect @destFile to be?
You do not need an "@" in front of a variable name unless you are trying to use a keyword as a variable name - and if you are doing that, then you need to rethink your coding style. To call something public or string would require the "@" prefix, because they are both specific words that the compiler understands - but destFile is not, and does not need it.
C#
int @public = 666;
Console.WriteLine(@public);
...
string destFile = "...";
Console.WriteLine(destFile);


And if you don't assign a value to destFile before you use it as an output location, you will get an error - it needs to contain a valid filename, in a folder that is not restricted for security reasons:
C#
string destFile = "D:\Test Data\byList.csv";
File.WriteAllLines(destFile, elem);


So use the debugger to examine exactly what you have in destFile before you try to write to the file and check it's a fully valid filename!
If you don't know how to use it then a quick Google for "Visual Studio debugger" should give you the info you need.

Put a breakpoint on the first line in the function, and run your code through the debugger. Then look at your code, and at your data and work out what should happen manually. Then single step each line checking that what you expected to happen is exactly what did. When it isn't, that's when you have a problem, and you can back-track (or run it again and look more closely) to find out why.

Sorry, but we can't do that for you - time for you to learn a new (and very, very useful) skill: debugging!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!

GeneralRe: System.IO.File.WriteAllLines exception Pin
_Flaviu6-Nov-20 3:33
_Flaviu6-Nov-20 3:33 
AnswerRe: System.IO.File.WriteAllLines exception Pin
Richard MacCutchan6-Nov-20 6:21
mveRichard MacCutchan6-Nov-20 6:21 
GeneralRe: System.IO.File.WriteAllLines exception Pin
_Flaviu7-Nov-20 22:08
_Flaviu7-Nov-20 22:08 
QuestionHow to extract part of HTML source? Pin
Member 5697394-Nov-20 8:53
Member 5697394-Nov-20 8:53 
AnswerRe: How to extract part of HTML source? Pin
OriginalGriff4-Nov-20 9:37
mveOriginalGriff4-Nov-20 9:37 
GeneralRe: How to extract part of HTML source? Pin
Member 5697394-Nov-20 10:12
Member 5697394-Nov-20 10:12 
AnswerRe: How to extract part of HTML source? Pin
Richard Andrew x644-Nov-20 15:11
professionalRichard Andrew x644-Nov-20 15:11 
AnswerRe: How to extract part of HTML source? Pin
DerekT-P5-Nov-20 0:29
professionalDerekT-P5-Nov-20 0:29 
GeneralRe: How to extract part of HTML source? Pin
Richard Deeming5-Nov-20 0:36
mveRichard Deeming5-Nov-20 0:36 
GeneralRe: How to extract part of HTML source? Pin
DerekT-P5-Nov-20 1:26
professionalDerekT-P5-Nov-20 1:26 
GeneralRe: How to extract part of HTML source? Pin
Member 5697395-Nov-20 4:56
Member 5697395-Nov-20 4:56 
QuestionHow to switch the whole DataGridView Left-To-right? Pin
Alex Dunlop4-Nov-20 8:46
Alex Dunlop4-Nov-20 8:46 
AnswerRe: How to switch the whole DataGridView Left-To-right? Pin
BillWoodruff4-Nov-20 15:21
professionalBillWoodruff4-Nov-20 15:21 
AnswerRe: How to switch the whole DataGridView Left-To-right? Pin
Mycroft Holmes5-Nov-20 11:50
professionalMycroft Holmes5-Nov-20 11:50 
QuestionMoving VS 2019 solution from on-premise to cloud Pin
Member 144746074-Nov-20 8:27
Member 144746074-Nov-20 8:27 
AnswerRe: Moving VS 2019 solution from on-premise to cloud Pin
Richard Andrew x644-Nov-20 15:05
professionalRichard Andrew x644-Nov-20 15:05 
QuestionWinForm - Localize DataGridView with automatical generated columns Pin
Mc_Topaz4-Nov-20 0:08
Mc_Topaz4-Nov-20 0:08 

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.