Learn · Languages
C# — Java’s cousin
Here’s the truth that should calm you: C# and Java are ~90% the same language. Same OOP, same data structures, near-identical syntax. If you can write Java, you can read C# this weekend — and Siemens uses both.
Before we start
- What C# is and how it relates to Java
- The handful of syntax differences that matter
- C#-only niceties: properties, LINQ, var
- Why Siemens values it — and why you shouldn’t panic
- Read C# code confidently coming from Java
- Translate a small Java method into C#
- Say honestly “I work in Java and I’m picking up C#”
Why you’re learning it: Siemens builds on C#/.NET as well as Java. You don’t switch — you add C# awareness so you can say “I’m Java-first and comfortable in C#.” Do OOP first. ⏱️ ~25 min.
What is C#?
C# (“C-sharp”) is Microsoft’s language, born as a Java-like language for the .NET platform. It’s statically typed, object-oriented, and reads almost exactly like Java. Everything you learned — classes, the 4 pillars, collections, loops — transfers directly. Your first C# program:
using System;
class Program {
static void Main() {
Console.WriteLine("Hello, Darshan");
}
}If that looks like Java with the print statement renamed — good. That’s the whole vibe.
The 90 / 10 split — see it at a glance
Almost everything you know carries over. You’re learning a new accent, not a new language.
Java → C#, side by side
| Java | C# |
|---|---|
System.out.println(x) | Console.WriteLine(x) |
String name | string name |
public void doThing() | public void DoThing() // PascalCase |
List<Integer> | List<int> |
class Dog extends Animal | class Dog : Animal |
implements Runnable | : IRunnable // interfaces start with I |
package com.app | namespace App |
getters / setters | properties: get; set; |
The biggest visible differences: methods are PascalCase (DoThing), inheritance/interfaces use a colon, and interfaces start with I.
Three C# niceties worth knowing
- Properties — instead of getBalance()/setBalance(), C# has
public long Balance { get; set; }: clean getters/setters built in. - LINQ — query collections like SQL:
numbers.Where(n => n > 5). Java’s Streams do the same thing. - var —
var list = new List<int>();lets the compiler infer the type (Java has this too now).
Where you’ll use it — real life
C#/.NET runs huge business systems — including parts of Siemens Healthineers.
Unity (the game engine) is scripted in C#.
Desktop and Windows services are commonly C#.
Everything from your Java + DSA lessons applies directly — you’re not starting over.
Now YOU do the reps
- Take your Java BankAccount (from OOP) and rewrite it in C# — private field, a
Balanceproperty, aDepositmethod. - Read one official C# tour section and note every difference from Java you spot.
Out loud: “How is C# similar to Java, and name three differences.” Then log it in your Journal.
Next: .NET — where C# runs →