Skip to content

Instantly share code, notes, and snippets.

Ibrahim Šuta Ibro

Block or report user

Report or block Ibro

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View MyConnectionManager.cs
public class MyConnectionManager : IMyConnectionManager
{
private readonly ILogger<MyConnectionManager> _logger;
private readonly IMyScopedService _myScopedService;
public MyConnectionManager(ILogger<MyConnectionManager> logger, IMyScopedService myScopedService)
{
_logger = logger;
_myScopedService = myScopedService;
}
@Ibro
Ibro / MyScopedService.cs
Last active Jan 18, 2020
ASP.NET Core DI
View MyScopedService.cs
public class MyScopedService : IMyScopedService
{
private readonly ILogger<MyScopedService> _logger;
public MyScopedService (ILogger<MyScopedService> logger)
{
_logger = logger;
}
public void DoSomething ()
@Ibro
Ibro / Startup.cs
Created Jan 18, 2020
ASP.NET Core DI
View Startup.cs
public void ConfigureServices(IServiceCollection services)
{
services.AddScoped<IMyScopedService, MyScopedService>();
services.AddSingleton<IMyConnectionManager, MyConnectionManager>();
}
View config.yml
version: 2
jobs:
build:
machine: true
steps:
- checkout
# build image
- run: |
docker info
View Dockerfile
FROM microsoft/dotnet:2.2-sdk AS build-env
WORKDIR /app
# Copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore
# Copy everything else and build
COPY . ./
RUN dotnet publish -c Release -o out
View Span.cs
using System;
using System.Collections.Generic;
namespace SpanOfT_Dev
{
public class Program
{
private static void Main(string[] args)
{
int[] arr = { 1, 2, 3, 4, 5 };
View Span.cs
using System;
using System.Collections.Generic;
namespace SpanOfT_Dev
{
public class Program
{
private static void Main(string[] args)
{
int[] arr = { 1, 2, 3, 4, 5 };
View Span.cs
using System;
namespace SpanOfT_Dev
{
public class Program
{
private static void Main(string[] args)
{
int[] arr = { 0, 1, 2, 3, 4, 5 };
Span<int> span = arr.AsSpan();
@Ibro
Ibro / Span.cs
Created May 23, 2018
More C# 7 goodness - Span<T> - Span of T - CodingBlast
View Span.cs
int[] arr = { 0, 1, 2, 3, 4, 5 };
Span<int> span = arr.AsSpan();
foreach (var number in span)
{
Console.WriteLine(number);
}
You can’t perform that action at this time.