Home Programming C Sharp REPL example

C Sharp REPL example

by shedboy71

Previously we showed you a C# example for your Raspberry Pi. We installed a text editor and then the mono development environment. We then created our c sharp example in our text editor , compiled and ran it. This typically is the way you write programs and develop but mono gives you another option called C# REPL, this is a interactive shell that is part of the mono development environment. More details available fromĀ http://www.mono-project.com/docs/tools+libraries/tools/repl/

Open up the terminal and type in csharp at the command prompt, you should see something like the following

csharp console

csharp console

In the following examples we will try some easy one liners using the Environment Class. More details can be found at https://msdn.microsoft.com/en-us/library/system.environment.osversion%28v=vs.110%29.aspx

 

Environment.OSVersion
 
Environment.ProcessorCount
 
Environment.MachineName

 

You can see these and some other examples below

csharp REPL

csharp REPL

You may also like