i like how you explain what each and every one of your code does. this really helps my learning experience as i waste 20:44 min of my life basically learning nothing
Small error at about 3:40 - new DirectoryInfo() does not create a new directory on the file system. Check the .Exists property. Needs to be done with Directory.CreateDirectory. Otherwise nice work.
I should've looked at the comments before panicking lol. It wasn't working for me, and I ended up looking all around the Internet for why it wasn't working and found your solution along the way. Thanks for pointing this out!
I gave this video a like within the first 19 seconds. Why? Because you clearly laid out your video in a nice way, and your title is descriptive and helpful for understanding that what you're going to go over will likely help me. I appreciate it!
Do you can solve this; Build Application that has three classes (three user data types). Every class has some of attributes and methods to manipulate the objects of these classes. The objects and their data can be saved permanently into Files. Every class have to save in three forms of files: 1. Object Stream. 2. Data Stream. 3. Random Access File Stream. Data can be brought mainly from csv file. Every record consists of multiple fields, and every line has only one record,
Derek, i appreciate your straight to the point and condensed information. I have to watch them a few times but i would rather it be that way that slower. This seems to be your style and you seem to be the only one i can find on TH-cam that condenses this information in such a concise and direct manner. I enjoy your wide variety of examples and the many options that you show us so that we can then choose what we need. I would like this video a million more times but unfortunately it only lets me like it once.
Thank you for the very nice message :) Yes I go out of my way to be different from the other channels on YT. I think I'm the only person that covers such a wide range of topics and who makes heavily edited long videos. I'm glad you like them.
Derek I wish you would make these videos twice as long and really take more time in explaining everything slower. These videos seem so rushed. I really like the videos but I always need to rewind and pause. Also you seem to gloss overthings when really if you explained them in detail I think people would learn better from watching these videos.
Can't agree enough with you, Erik. Luckily for me, I knew some of these things and watching this video helped me refresh and definitely take in new stuff faster, though sometimes this formula is not the best. This said, I want to thank Derek for taking the time to do this series of videos that I will watch every and now and then.
First video I've watched but will definitely watch the others. By far the most informative and well laid out tutorial I've seen. Straight to the point and clearly shows how methods can be used.
A question, when Reading data with filestreams, Why is it we need to create an additional bytearray to store the bytes from rsByteArray, Why not just get the rsByteArray and use the .GetString function on that?
Is it possible to create and write to a text document as a different user? I'm building a digital forensic challenge creation toolkit using C# and powershell. I require the use of administration access to manipulate the flow of time within the toolkit however I would be interested if it were possible to write files as a standard user using the system.io library. I can achieve this using powershell however, the Lochard Principal really puts pressure on my design to limit any potential fingerprint where possible.
Thanks for the tutorial this is what I was looking for. But how can I read write and create files which are saved in individual paths? Example - someone installs the program to the disc D but in code is given dir to desktop on the disc C. Does IO system offers path reading? I know there is smth like Environment.MachineName and so on, but in this case you have to define a lot of strings to get the whole path.
Hi Derek, I have been having difficulty sending commands to cmd. I have tried using streamwriter and processes. Is there a different method I should be using? Thank you for your time.
I realize that this video is over 3 years .. I'm wondering what kind of application can read the testFile4.dat that is produced at the very end. I tried opening with Excel and LibreOffice Calc which rendered Random Text*@ and then garbleDgook.. I tried Unicode (UTF-8)..
What I found is.... A file with the . dat file extension is a generic data file, that stores specific information relating to the program that created the file. So I tried opening it with VS, since that is what created it. No, luck opening it that way. It's not always a text file, and it can be in use, with an app., making it hard to delete. Remember the index.dat, back in the day, that kept a log of every site you visited; I couldn't delete it, but could delete the content. So, to open the dat file, I used HxD Hex Editor app to view/edit it.
That would be amazing, it just where I'm studying right now as a first year in faculty, we are studying everything in WinForms, even i don't know, it is an old technology right now while already we have WPF, or it is still in use. While our professor said that WPF requires that you master a large number of quite difficult concepts before you even get around to writing a line, and you will get disheartened very quickly because of this reason. Also we choose WinForms if they have to expand the reach of their software to other operating systems. Mono/xamarin do not support WPF and it would take some time for them to. WinForms it meant to be cross platform code on C#. Also in my experience, a WPF application takes up more RAM than its Windows Forms counterpart. Also I think that with WPF we can create Windows Phone and Windows Store apps, while with WinForms we cannot, correct me if I'm wrong. You are doing a really amazing and a great job for students, enthusiasts, amateurs and for humanity after all. And sorry for my English but i will also work on it so soon to make it better.
It treats the string as it is written. so you don't need to put slashes to make certain characters work. Although " are still an issue, because they are still used to end the verbatim string, as it is called.
You're videos are great both for leaning and refreshing. Keep up the good work. Would it be simple enough to cover how to read data from input devices using C# (particularly gamepads)? Also platinum!
sir i am facing one problems in my asp.net project.....i use many master pages and more than 20 content pages of one master page the problem is how to manage all folders...in solution explorer there is more than 300 folders how to merge one master page and its content page in one folder. pls help me i search every where but no any result
Hey Derek, I want your professional opinion about a project I have undertaken. Its a frontend heavy web app and I require a good framework for this. Im thinking about using one of these: Angular2, AngularDart, VueJS, Polymer, AureliaJS. I cant decide which one to use!
Derek Banas Well the apps main page has a "wall" that resembles FBs wall, apart from that we have a user profile page, a page to view posts, basically the whole 9 yards of a social media app. Im not at liberty to disclose project details so I hope this will be enough.
cool! If i come from a more "java-world" can i use dll-files and SDK from a C# project some how? (if i have the docks for the C# files) :-) thanks for your great videos!
Hello Derek, I've been trying to follow this tutorial but when I use "File.WriteAllLine(TextFilepath, Customers);" it throws a "Directory not found Exception" I've tried creating a folder with windows and making a legit directory with cmd But nothing worked can you please help me.
I forgot to wirte the 's' in Lines in the comment but not in the code. I've managed to fix it I had to manually write "DataDir.Create()" after initiallizing "DirectoryInfo DataDir"
//Creating a directory DirectoryInfo newDirectory = new DirectoryInfo(@"C:\Users\etc\etc"); newDirectory.Create(); //This method will create a directory newDirectory.Delete(); //This method will delete the directory
What if i have a text file having two Columns of integers separated by "\t" like this: 12 23 14 56 56 67 ... .... n i want that the integers of first column gets store in an array ( Like this: x[0]=12,x[1]=14, x=[2]=56 n so on ) , and the 2nd one gets store in 2nd array, How it can be Done ? and wt class should we use for this, StreamReader, FIlestream e.t.c. . . .
int i = 0; int x[], y[]; foreach(string line in File. ReadAllLines(textFilePath)) { string[] s = line. Split("\t"); x[i] = Convert. ToInt32(s[0], 10); y[i++] = Convert. ToInt32(s[1], 10); }
@@derekbanas By default it appends content to the file when writing? What about rewriting from the beginning of the file. Do you have to delete and recreate it, and then to write it?
Hey Derek! I just thought, if it would perhaps be a good idea to build a community forums, or something like that, around your channel :) Just a place where we can talk and help each other, I think it would be great, especially with your comments on fan-building.
That would be great, but I'm a bit tied up right now. It is kind of hard to manage multiple comment systems. I actually had to shut the one off on my website because people kept trying to hack my site with it. I'll look into it.
Yes C# is great! Normally if I do a video I already know the language. If I have to learn a new language I normally get the best 2 books on the topic and read them. Then I write lots of programs while referring to the API, blogs, etc. to learn what isn't in books.
I don't understand the videos (I don't speak Russian) and I'm not sure if you want to hear this, but you are actually doing fantastic. You grew your channel to almost 5,000 subscribers in a year. In the education space that is just about the best you can expect. Look at my channel for an example. I have almost 600,000 subscribers, but really I only have about 2,000 fans. There is a great difference between subscribers and fans. You actually have a higher percentage of fans then I do. To increase your fans show yourself and your personality more. I wish I would have learned this lesson earlier. To most people I'm just a random voice. In your next video series try showing your face while you write code and see if the percentage drop off from video 1 improves versus video 2. That is the best gage of whether you are improving your videos or not. Maybe try increasing your font size a little. Your voice is great and the code is great. It takes time to build an audience. Don't make the same mistake I made. Build fans instead of subscribers.
@@derekbanas personally, I don't agree to your answer as a whole. I dont like people showing their faces and try to become stars or gain fans or something on a thing like TH-cam by uploading random videos. That's just stupidity for me. i dont personally click those videos in which I see that kind of stuff like show off or trying to do some useless talk which increases the duration of the video. On the other hand I agree with the quality and font size thing you said. Most of the people I know, including me, are on TH-cam whenever they are, just to learn something or get entertained and your channel is for learning so they only want something straightforward and to the point, which you are giving, and that's why you have such success on here.
i like how you explain what each and every one of your code does. this really helps my learning experience as i waste 20:44 min of my life basically learning nothing
Small error at about 3:40 - new DirectoryInfo() does not create a new directory on the file system. Check the .Exists property. Needs to be done with Directory.CreateDirectory. Otherwise nice work.
Whoops sorry about that
Lunsterful, I was looking for that comment! Thanks.
Derek, watched all the C# videos (and much more) big thanks for your amazing work!
@@derekbanas Just learning C# - instead of the suggested "Directory.CreateDirectory" I have used "dataDir.Create(); seems to work OK
I should've looked at the comments before panicking lol. It wasn't working for me, and I ended up looking all around the Internet for why it wasn't working and found your solution along the way. Thanks for pointing this out!
THANK YOU SO MUCH!
I like the variety of how you create an instance of a stream.
I like that you get write (pun intended) to the point and not waste time, telling us useless information about anything and everything.
I do my best to not waste peoples time :)
I gave this video a like within the first 19 seconds. Why? Because you clearly laid out your video in a nice way, and your title is descriptive and helpful for understanding that what you're going to go over will likely help me. I appreciate it!
Do you can solve this;
Build Application that has three classes (three user data types). Every class has
some of attributes and methods to manipulate the objects of these classes.
The objects and their data can be saved permanently into Files. Every class have
to save in three forms of files:
1. Object Stream.
2. Data Stream.
3. Random Access File Stream.
Data can be brought mainly from csv file. Every record consists of multiple fields,
and every line has only one record,
Derek, i appreciate your straight to the point and condensed information. I have to watch them a few times but i would rather it be that way that slower. This seems to be your style and you seem to be the only one i can find on TH-cam that condenses this information in such a concise and direct manner. I enjoy your wide variety of examples and the many options that you show us so that we can then choose what we need. I would like this video a million more times but unfortunately it only lets me like it once.
Thank you for the very nice message :) Yes I go out of my way to be different from the other channels on YT. I think I'm the only person that covers such a wide range of topics and who makes heavily edited long videos. I'm glad you like them.
Derek I wish you would make these videos twice as long and really take more time in explaining everything slower. These videos seem so rushed. I really like the videos but I always need to rewind and pause. Also you seem to gloss overthings when really if you explained them in detail I think people would learn better from watching these videos.
Can't agree enough with you, Erik. Luckily for me, I knew some of these things and watching this video helped me refresh and definitely take in new stuff faster, though sometimes this formula is not the best. This said, I want to thank Derek for taking the time to do this series of videos that I will watch every and now and then.
First video I've watched but will definitely watch the others.
By far the most informative and well laid out tutorial I've seen.
Straight to the point and clearly shows how methods can be used.
Thank you for the compliment :)
Ok tutorial -but it would be more useful if time were explained on why things work one way instead of just showing...
Derek Banas - The savior of computer science students.
Also, platinum :D
Thank you :) I'm happy to be of service
A question, when Reading data with filestreams, Why is it we need to create an additional bytearray to store the bytes from rsByteArray, Why not just get the rsByteArray and use the .GetString function on that?
best C# tutorial series out there :P thanks :)
Thank you :) I'm trying to cover everything
Derek Banas ik and you're doing a remarkable job at it :) so thank you :)
Great as always, Thanks for those tutorials!
I've learned so much from your channel :)
Thank you :) I'm very happy to hear that!
I feel so much better after watching this.
Thank you very much :) I'm happy that you liked it
i always listen to derek banas in x2 speed ;P
That's funny :)
so do I!
It doesn't make any sense. Why would anyone do that? You can't understand anything like that!
x1.5 for me
Why do we need to create a byte array to hold file data or fileByteArray ?can't we directly output the rsByteArray?
Is it possible to create and write to a text document as a different user? I'm building a digital forensic challenge creation toolkit using C# and powershell. I require the use of administration access to manipulate the flow of time within the toolkit however I would be interested if it were possible to write files as a standard user using the system.io library. I can achieve this using powershell however, the Lochard Principal really puts pressure on my design to limit any potential fingerprint where possible.
First of all, thank you for the videos Derek. Would you mind to teach us serialize and deserialize data with C#? Thank you.
I'm happy to help and plan on covering that in the next video :)
Thanks for the tutorial this is what I was looking for. But how can I read write and create files which are saved in individual paths? Example - someone installs the program to the disc D but in code is given dir to desktop on the disc C. Does IO system offers path reading?
I know there is smth like Environment.MachineName and so on, but in this case you have to define a lot of strings to get the whole path.
Hey derek!, do you have any tutorial for c# form application?. As always great video! :)
Thank you :) WPF and XAML is coming next week
You are great. Thanks for teach us.
Thank you for the compliment :) It is my pleasure to help
Dont give up Derek! :-)
I've been doing this for 7 years and I don't plan on quitting :)
I really like the you speak your american english! like someone talking to his own heart
Thank you :)
Hi Derek, I have been having difficulty sending commands to cmd. I have tried using streamwriter and processes. Is there a different method I should be using? Thank you for your time.
Can you make a video about creating a C# RegEx Console app? I want to find and replace things in some html documents.
Sorry, but I'm not sure what you want to do
Derek, are you based on your recommended book to make these C# tutorials? Thank you.
I have a professor friend poll students to see what books they prefer
I realize that this video is over 3 years .. I'm wondering what kind of application can read the testFile4.dat that is produced at the very end. I tried opening with Excel and LibreOffice Calc which rendered Random Text*@ and then garbleDgook.. I tried Unicode (UTF-8)..
What I found is.... A file with the . dat file extension is a generic data file, that stores specific information relating to the program that created the file. So I tried opening it with VS, since that is what created it. No, luck opening it that way.
It's not always a text file, and it can be in use, with an app., making it hard to delete. Remember the index.dat, back in the day, that kept a log of every site you visited; I couldn't delete it, but could delete the content.
So, to open the dat file, I used HxD Hex Editor app to view/edit it.
I can not speak and understand english. But dont know why I've understood this SYSTEM IO
Do we can use these codes also with forms too or just for consoles ? Thank you so much for your fantastic work.
Yes I get into forms very soon
That would be amazing, it just where I'm studying right now as a first year in faculty, we are studying everything in WinForms, even i don't know, it is an old technology right now while already we have WPF, or it is still in use. While our professor said that WPF requires that you master a large number of quite difficult concepts before you even get around to writing a line, and you will get disheartened very quickly because of this reason. Also we choose WinForms if they have to expand the reach of their software to other operating systems. Mono/xamarin do not support WPF and it would take some time for them to. WinForms it meant to be cross platform code on C#. Also in my experience, a WPF application takes up more RAM than its Windows Forms counterpart. Also I think that with WPF we can create Windows Phone and Windows Store apps, while with WinForms we cannot, correct me if I'm wrong. You are doing a really amazing and a great job for students, enthusiasts, amateurs and for humanity after all. And sorry for my English but i will also work on it so soon to make it better.
A question. What is the @ letter before the strings? I have been googling it for 10 minutes and can't find the answer...
It treats the string as it is written. so you don't need to put slashes to make certain characters work. Although " are still an issue, because they are still used to end the verbatim string, as it is called.
You're videos are great both for leaning and refreshing. Keep up the good work. Would it be simple enough to cover how to read data from input devices using C# (particularly gamepads)? Also platinum!
Thank you very much :) Sure I'll cover how to handle input. I'll start making games soon
Awsome! Thx for really good explaination!
Thank you :) I'm happy you enjoyed it
Thanks you so much Derek your video are the best
Hi how can we read a file from the middle of the file to the top of the file??
sir i am facing one problems in my asp.net project.....i use many master pages and more than 20 content pages of one master page the problem is how to manage all folders...in solution explorer there is more than 300 folders how to merge one master page and its content page in one folder. pls help me i search every where but no any result
from which age did you start learn programming?
I started 30 years ago around the age of 10, but I didn't get serious until about 15
Hey Derek, I want your professional opinion about a project I have undertaken. Its a frontend heavy web app and I require a good framework for this. Im thinking about using one of these: Angular2, AngularDart, VueJS, Polymer, AureliaJS. I cant decide which one to use!
Tell me more and I'll give you my opinion based on your goal
Derek Banas Well the apps main page has a "wall" that resembles FBs wall, apart from that we have a user profile page, a page to view posts, basically the whole 9 yards of a social media app. Im not at liberty to disclose project details so I hope this will be enough.
I'm actually using Vue for a similar project.
I personally would use PHP / Laravel to design a site like that, but that is just what I'm used to using
cool!
If i come from a more "java-world" can i use dll-files and SDK from a C# project some how? (if i have the docks for the C# files)
:-)
thanks for your great videos!
Thank you :) Are you trying to execute C# from Java?
Yes...
I have a sdk with dll:s and I like to use those functions in java..
Hello Derek, I've been trying to follow this tutorial but when I use "File.WriteAllLine(TextFilepath, Customers);"
it throws a "Directory not found Exception" I've tried creating a folder with windows and making a legit directory with cmd
But nothing worked can you please help me.
Hello, You have a little bug. Try File.WriteAllLines(textFilePath, customers); You forgot the s
I forgot to wirte the 's' in Lines in the comment but not in the code. I've managed to fix it I had to manually write "DataDir.Create()" after initiallizing "DirectoryInfo DataDir"
Great I'm glad you fixed it. Sorry I couldn't help quicker
//Creating a directory
DirectoryInfo newDirectory = new DirectoryInfo(@"C:\Users\etc\etc");
newDirectory.Create(); //This method will create a directory
newDirectory.Delete(); //This method will delete the directory
File.WriteAllLines(textFilePath, customers);
Error : Directory not found exception was unhandled
I have working code here www.newthinktank.com/2017/03/c-tutorial-17/
What if i have a text file having two Columns of integers separated by "\t" like this:
12 23
14 56
56 67
... ....
n i want that the integers of first column gets store in an array
( Like this: x[0]=12,x[1]=14, x=[2]=56 n so on ) , and the 2nd one gets store in 2nd array, How it can be Done ? and wt class should we use for this, StreamReader, FIlestream e.t.c. . . .
int i = 0;
int x[], y[];
foreach(string line in File. ReadAllLines(textFilePath)) {
string[] s = line. Split("\t");
x[i] = Convert. ToInt32(s[0], 10);
y[i++] = Convert. ToInt32(s[1], 10);
}
Thank you kindly for another amazing video. :)
You're very welcome :) Thank you
Thank you for your well-made video. I really learned something👌👍
I'm very happy I could help :)
Great as always!
Thank you :)
thanks for the tutorials
How can you add more text to the file after sr.Close()?
You have to open it again
@@derekbanas By default it appends content to the file when writing? What about rewriting from the beginning of the file. Do you have to delete and recreate it, and then to write it?
Hey Derek! I just thought, if it would perhaps be a good idea to build a community forums, or something like that, around your channel :) Just a place where we can talk and help each other, I think it would be great, especially with your comments on fan-building.
That would be great, but I'm a bit tied up right now. It is kind of hard to manage multiple comment systems. I actually had to shut the one off on my website because people kept trying to hack my site with it. I'll look into it.
what is I what to make this on one computer then open it it on a different pc?
C# programs can be compiled as executables on any OS
what if the Directory is set for my pc. Not the other pc.
thank you so much for this video! I'm really starting to like C#.
I was wondering how you learn these languages before you make the videos?
Yes C# is great! Normally if I do a video I already know the language. If I have to learn a new language I normally get the best 2 books on the topic and read them. Then I write lots of programs while referring to the API, blogs, etc. to learn what isn't in books.
visual studio is late is there any lite weight ide for c#
Sorry I don't understand the question. What do you mean by late?
i mean it is resource hungry and i don't have a good setup. So it runs slower on my system
SharpDevelop is your IDE.
Thank you for helping :)
No problem, I'm glad I could help :-)
Platinum.
Thank you for this video
I'm happy you liked it :)
thanks
Thanks for the tutorial! Platinum
You're very welcome :)
Can you do GML in one video plz
Gamemaker or Geography Markup Language?
Derek give me please some advices how to grow up my channel with Russian audience? You are my idol.
I don't understand the videos (I don't speak Russian) and I'm not sure if you want to hear this, but you are actually doing fantastic. You grew your channel to almost 5,000 subscribers in a year. In the education space that is just about the best you can expect. Look at my channel for an example. I have almost 600,000 subscribers, but really I only have about 2,000 fans. There is a great difference between subscribers and fans. You actually have a higher percentage of fans then I do. To increase your fans show yourself and your personality more. I wish I would have learned this lesson earlier. To most people I'm just a random voice. In your next video series try showing your face while you write code and see if the percentage drop off from video 1 improves versus video 2. That is the best gage of whether you are improving your videos or not. Maybe try increasing your font size a little. Your voice is great and the code is great. It takes time to build an audience. Don't make the same mistake I made. Build fans instead of subscribers.
Derek Banas thank you for your answer!
I really appreciate this genuine answer to his question.
@@derekbanas the goat for this reply
@@derekbanas personally, I don't agree to your answer as a whole. I dont like people showing their faces and try to become stars or gain fans or something on a thing like TH-cam by uploading random videos. That's just stupidity for me. i dont personally click those videos in which I see that kind of stuff like show off or trying to do some useless talk which increases the duration of the video. On the other hand I agree with the quality and font size thing you said. Most of the people I know, including me, are on TH-cam whenever they are, just to learn something or get entertained and your channel is for learning so they only want something straightforward and to the point, which you are giving, and that's why you have such success on here.
C# Reminds me of PASCAL.
Really? I always considered it a better version of Java
do LUA!
Here you go th-cam.com/video/iMacxZQMPXs/w-d-xo.html
yay!
I have subscribed😊
Thank you :)
I am getting a error
File download not webclient
Platinum
Thank you for doing that :)
Platinum :)
Thank you :)
Awesome. :)!
Thank you :)
:)
viet nam
I did it I am First!!!!!!!!!!!
Congratulations :) That was fast
I am simple man I see your videos I click :) , and as always thank you for these good videos
I greatly appreciate it that you watch them :)
Yeah, too bad he didn't see the Platinum :-)
Platinum
Thank you :)
Platinum
Platinum