Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
docs.it4i.cz
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SCS
docs.it4i.cz
Merge requests
!166
Gajdusek clean
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Gajdusek clean
gajdusek_clean
into
master
Overview
0
Commits
4
Pipelines
0
Changes
2
Merged
Pavel Gajdušek
requested to merge
gajdusek_clean
into
master
7 years ago
Overview
0
Commits
4
Pipelines
0
Changes
2
Expand
Added C# and MPI.NET
0
0
Merge request reports
Viewing commit
fda6835b
Prev
Next
Show latest version
2 files
+
79
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
fda6835b
added csharp
· fda6835b
Pavel Gajdušek
authored
7 years ago
docs.it4i/software/csc.md
0 → 100644
+
78
−
0
Options
# CSharp
C# is available on the cluster. Activate C# by loading the Mono module:
```
console
$
ml Mono
```
## Examples
### Hello World
Copy this code to new file hello.cs:
```
csc
using System;
class HelloWorld {
static void Main() {
Console.WriteLine("Hello world!!!");
}
}
```
Compile the program and make
*Windows executable*
.
```
console
$
mcs
-out
:hello.exe hello.cs
```
This command should not return any error status. You can try to remove one of the curly brackets to get error output:
```
console
csc.cs(7,246): error CS1525: Unexpected symbol `end-of-file
Compilation failed: 1 error(s), 0 warnings
```
Now run the program:
```
console
$
mono hello.exe
Hello world!!!
```
### Interactive Console
Type:
```
console
$
csharp
Mono C#
Shell,
type
"help;"
for
help
Enter statements below.
csharp>
```
Now you are in interactive mode. You can try following example.
```
csc
csharp> using System;
csharp> int a = 5;
csharp> double b = 1.5;
csharp> Console.WriteLine("{0}*{1} is equal to {2}", a,b,a*b);
5*1.5 is equal to 7.5
csharp> a == b
false
```
Show all files modified in last 5 days:
```
csc
csharp> using System.IO;
csharp> from f in Directory.GetFiles ("mydirectory")
> let fi = new FileInfo (f)
> where fi.LastWriteTime > DateTime.Now-TimeSpan.FromDays(5) select f;
{ "mydirectory/mynewfile.cs", "mydirectory/script.sh" }
```
For more informations look at
[
Mono documentation page
](
http://www.mono-project.com/docs/
)
.
Loading