z czym to się je?

using System;

namespace Aspire.SKM {

    public class SkmSession {
        static void Main(string[] args)
        {
            if (1 == 1)
            {
    	        Console.WriteLine("Hello World!");	
            }
        }	
    }
}
public class Hello {

  public static void main(String[] args) {
    if (1 == 1) {
        System.out.print("Hello World");
    }
  }
}
using System;

namespace Aspire.SKM {

    public class SkmSession {
        static void Main(string[] args)
        {
            if (1 == 1)
            {
    	        Console.WriteLine("Hello World!");	
            }
        }	
    }
}
public class Hello {

  public static void main(String[] args) {
    if (1 == 1) {
        System.out.print("Hello World");
    }
  }
}

C# (pronounced see sharp, like the musical note C♯, but written with the number sign)[b] is a general-purpose, multi-paradigm programming language encompassing strong typing, lexically scoped, imperative, declarative, functional, generic, object-oriented (class-based), and component-oriented programming disciplines.

(...) object-oriented (class-based), and component-oriented (...)

virtual

interaface

package com.journaldev.java.legacy;

public class MyApplication {

	private EmailService emailService;
	
	public MyApplication(EmailService emailService) {
		this.emailService = emailService;
	}
	
	public void processMessages(String msg, String rec){
		this.email.sendEmail(msg, rec);
	}
}

Why no interface?

EmailService

IEmailService

In Java all instance methods are virtual by default

In C# it's the opposite

Composition vs Inheritance

JVM and .NET

  • Both Virtual Machines (VMs)
  • Both include garbage collection
  • Both employ stack-based operations
  • Both include runtime-level security
  • Both have methods for exception handling

How about functional programming?

C# has some functional-like features...

  • local functions
  • pattern matching
  • method chains, pipelines
  • extension methods
  • delegates and high-order functions
  • expressions
  • tuples
  • nullable references

.. ande more are coming 

  • discriminated unions
  • records
  • parameter null-checking
  • attributes on local functions [NotNull]
  • ...

+ MVC

Manager paczek (zamiast Mavena czy CocoaPods) 

You don't need Windows to start with .NET

CORE

API + MVC

// PUT: api/TodoItems/5
[HttpPut("{id}")]
public async Task<IActionResult> PutTodoItem(long id, TodoItem todoItem)
{
    if (id != todoItem.Id)
    {
        return BadRequest();
    }

    _context.Entry(todoItem).State = EntityState.Modified;

    try
    {
        await _context.SaveChangesAsync();
    }
    catch (DbUpdateConcurrencyException)
    {
        if (!TodoItemExists(id))
        {
            return NotFound();
        }
        else
        {
            throw;
        }
    }

    return NoContent();
}

You can still write some frontend in .NET ;)

@page "/counter"

<h1>Counter</h1>

<p>Current count: @currentCount</p>

<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>

@code {
    private int currentCount = 0;

    [Parameter]
    public int IncrementAmount { get; set; } = 1;

    private void IncrementCount()
    {
        currentCount += IncrementAmount;
    }
}

You can use the same thing for mobile development

or

How to start?

Autoreklama - API w ASP.NET Core

Zapraszam na Slacka - pomogę, wytłumaczę, wyjaśnię :)

Miłego kodzenia :)

Zdrowych, wesołych świąt :)

deck

By Mateusz Turzyński