Main Site Documentation

Learning C#, question about System.IO


#1

So i have been reading this book on C# where he tells me to enter in "Console.WriteLine(“Hello World”);"
i start a new console application and start doing that. There was no Console.WriteLine.

so i start doing some poking around. I add the reference System.IO. and put using in my application.
I then click on System.IO in the references folder to see what methods are available for it. I see that there is WriteLine. see attached screen shot. with the given information there how to i implement it ?
I have tried System.IO. with that last dot i dont get WriteLine as an option for me.


#2

There is no “console” on embedded devices. You need debug.print instead


#3

Really? So when looking at the screenshot i listed how does one know what methods are avaiable and what is not ?

Now i am ticked that the book i bought “Expert .NET Micro Framework” which shows that is teaching me things that i cannot use.

Man, i gotta say learning .NETMF has been the most challenging thing i have ever encountered in coding. Most of the documentation seems like its cryptic at best.


#4

Maybe you are looking in the wrong place. You do not even need to buy any book.

100% of what you need is on www.tinyclr.com/support and all is free :slight_smile:


#5

Gus, i think you been a master at it to long to remember what its like to start out fresh.
I have been there many times and it does not start out from the ground up.
Even the C# school .pdf on page 29 says to use Console.Write. with having all this documentation around the net makes one head spin to know what i can use or what i cannot use.

Even looking at these links:

Microsoft .NET Micro Framework API Reference
GHI Electronics NETMF Documentation Jun. 30, 2011
WIZnet Ethernet Documentation (FEZ Connect) Jun. 24, 2011

Does nothing for me, take for instance “Microsoft .NET Micro Framework API Reference” that is where my original post started at. It shoes ConsoleWriteLine but yet there is no Console available.
so in looking at that page how is a newcomer supposed to know what they can or cannot use.

Then if i look at "GHI Electronics NETMF Documentation " there is a bunch of stuff there with not even a search. So remember i am new and just want to so something simple like shoot out hello world with a formatted counter.
In C i would do the following.

void main(void)
{

int x=0;

while(1)
{
    printf("Hello World: %05x",x++);

}

}

Now i am new to .NET i am told all i have it debug.print, but is there also formatting for it? and if i want to send that now to the serial port what methods am i going to sue for that, and is there formatting option for that as well ?

You see my experience so far with .NETMF has been this. When i first discovered it via your site. I was like this is the best thing known to man. now after reading and reading and just getting frustrated because its like there is no structure to it i am now like Ah, i see why its not taking off as fast in the real world as i initially would have expected. The docs assume to much by the reader.

again, if you were new to all this and knew nothing of the methods at your finger tips where would you start looking for specific things ?
even though i have "GHI Electronics NETMF Documentation " at my finger tips. I want to know all that i have available to me for printing either to the console or the serial port. Do the writers of that really expect people to open all that stuff and hunt for things that may not even be there.

Sorry if i sound frustrated, It is not my intention to take it out on you or any of the forum members.
You see people doing some great things with it and say to yourself ok, how did you get there. How did you know that method was even available. There are no good .NET<F books out there to speak of. At this point if there were i would be happy to spend $200 on that book.


#6

Take a deep breath… exhale…

The Micro Framework is a sub-set of the full .NET library. If you study a book on the full library you are going to find lots of goodies that are not implemented in the MF. There are no books on C# for the Micro Framework, since it is a sub-set.

As Gus said, you should find enough material here to get you started. If you have any questions post them… Generally we are gentle…

Again… Inhale… Exhale…

Have fun…


#7

There is limited formatting of string output in the MF.

You have to remember the MF is for embedded systems, which generally do not have high demands for formatted output. Putting formatting into the library would take up valuable memory space which would not be used by most developers.

I have been able to find a MF library on the Internet which supports formatted text.

If you want to read a MF book, I suggest “Expert .NET Micro Framework” by Jens Kuhner. It does not go into the C# sub-set, but there are lots of examples which will give you an idea how to do different things.

The Wiki also contains lots of good examples in projects.


#8

LOL! Thanks Mike!

I feel bad posting such elementary questions to such a wise group. i feel like a 3’rd grader that got thrown into senior year algebra class.

So if there are no books on it yet, why dont any of you write one?
Sounds like an open market to me.
Hell, start an on line class. i would be happy to pay for that! as well.

So from what it sounds like it is trial and error on what methods i can use ?
If i see the ConsoleWriteLine method, i then just try to see if it will work in my program, if the compiler barks that i know i cannot use it ?


#9

Want to go to chat?


#10

i just got that book this Friday! been reading it and i like his writing style. he makes it make sense.
but that is where the problem began. On page 53 he uses the Console.WriteLine. When i tried it and it did not work is when everything fell apart for me. I figured the title of the book shoe be only what it is about which i found out is not the case.

As far as print formatting, even the lowest micros like the Atmega8 has enough room for printf with long formatting for printing floats with no problem. i cannot see why these ARM7 & 9’s would even burp at using formatting.


#11

@ didufart I know where you’re coming from and being completely new to .NET and C# puts you at a particular disadvantage. The book you’re reading is actually a very good place to start. I just looked through the first few examples again to try and find the Console.WriteLine() you’re referring to and couldn’t. What page is it on? But, you are correct. Good documentation regarding getting started in NETMF is certainly lacking when compared to the rest of the .NET world. Post your questions away. Everyone here is eager to help.


#12

its on page 53


#13

I still say GHI should start making on line classes. They could even charge for it because no one else is doing it.
beginners have to start somewhere. GHI forum is awesome! i will say that. Now they can also have classes much like a on line college class.


#14

Or maybe a weekly video blog taking very small basic concepts from nothing to something in 10 - 15 minutes. It would be great stuff for people just getting started.

I’m sorry, but I’ve read page 53 and pages on either side of it multiple times now and cannot find any reference to Console. Do we have the same book? Mine is a hardbound and printed in 2008. What’s the whole line?


#15

i have the book Expert .NET Micro Framework" by Jens Kuhner, second edition. is the same book your referring to ?
the line reads Console.WriteLine(“No Device.”);


#16

Ahhh… I must have the first edition. Sounds like he introduced a bug :wink:


#17

huh, had a awesome chat with Mike. I am going to put this book down and start another book i got on OOP. hopefully that will start to unlock everything for me .

P.S. thanks mike for the time!


#18

As a note on the Console.Write/Debug.Print - the debug.print is just sending messages to your IDE. There is no Console on a netmf device, since without a debugger attached there is no way to show anything to the user as far as the chip knows :slight_smile:

Debug.Print is very very slow in your code and should only be used when you’re trying to figure some stuff out (i prefer to put a breakpoint in and just inspect everything that way).


#19

@ didufart: Not many people know this yet, but take a look at http://wiki.tinyclr.com/index.php?title=Help_Files_For_VS2010
It’s help files for VS2010(as the title suggests, i guess…:))

Maybe it will help.


#20

@ Errol, have you tired downloading the .zip file lately ?
I dried it from both locations and get an error when trying to unzip them.

Never mind, just saw it was zipped with 7zip :wink: