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; | |
} |
View MyScopedService.cs
public class MyScopedService : IMyScopedService | |
{ | |
private readonly ILogger<MyScopedService> _logger; | |
public MyScopedService (ILogger<MyScopedService> logger) | |
{ | |
_logger = logger; | |
} | |
public void DoSomething () |
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 output.txt
Array: | |
0 | |
0 | |
0 | |
0 | |
0 | |
Span: | |
0 | |
0 | |
0 |
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(); |
View Span.cs
int[] arr = { 0, 1, 2, 3, 4, 5 }; | |
Span<int> span = arr.AsSpan(); | |
foreach (var number in span) | |
{ | |
Console.WriteLine(number); | |
} |
NewerOlder