Skip to content

Instantly share code, notes, and snippets.

ichiroku11 ichiroku11

Block or report user

Report or block ichiroku11

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 Program.cs
using System;
namespace ConsoleApp {
class Program {
static void Main(string[] args) {
Console.WriteLine("Hello World!");
}
}
}
@ichiroku11
ichiroku11 / HomeController.cs
Created Dec 4, 2018
ASP.NET Core MVCでSerilogを使う
View HomeController.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
namespace WebApp.Controllers {
public class HomeController : Controller {
@ichiroku11
ichiroku11 / Program.cs
Created Oct 18, 2018
AutoMapper - コンストラクタを呼び出してマッピング
View Program.cs
using System;
using AutoMapper;
namespace ConsoleApp {
// 参考
// http://docs.automapper.org/en/stable/Construction.html
// コピー元
public class SampleSrc {
public int Id { get; set; }
@ichiroku11
ichiroku11 / Program.cs
Last active Oct 23, 2018
AutoMapper - 継承したオブジェクトをマッピングする
View Program.cs
using System;
using AutoMapper;
namespace ConsoleApp {
// コピー元の親クラス
public abstract class SampleSrcBase {
public int Id { get; set; }
public string Value1 { get; set; }
}
@ichiroku11
ichiroku11 / Program.cs
Last active Jan 25, 2019
Enumerable.PrependとEnumerable.Append(https://github.com/ichiroku11/Sample に移動)
View Program.cs
using System;
using System.Linq;
namespace ConsoleApp {
class Program {
static void Main(string[] args) {
// シーケンス
var source = new[] { 2, 3, 4 };
// Prepend:シーケンスの先頭に値を追加する
View Program.cs
using System;
namespace ConsoleApp {
class Program {
static void Main(string[] args) {
var matrix = new string[,] {
{ "1-1", "1-2", "1-3" },
{ "2-1", "2-2", "2-3" }
};
@ichiroku11
ichiroku11 / AccountController.cs
Last active Feb 14, 2019
ASP.NET Core MVC - クッキー認証(https://github.com/ichiroku11/Sample へ)
View AccountController.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
@ichiroku11
ichiroku11 / TempDataDictionaryExtensions.cs
Created Jul 27, 2018
ASP.NET Core MVC - TempDataにオブジェクト
View TempDataDictionaryExtensions.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Newtonsoft.Json;
namespace WebApp {
public static class TempDataDictionaryExtensions {
// TempDataにオブジェクトを書き込む
@ichiroku11
ichiroku11 / SessionExtensions.cs
Created Jul 27, 2018
ASP.NET Core MVC - セッションにオブジェクト
View SessionExtensions.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Newtonsoft.Json;
namespace WebApp {
public static class SessionExtensions {
// セッションにオブジェクトを書き込む
@ichiroku11
ichiroku11 / Startup.cs
Created May 17, 2018
グローバルフィルタで承認(認証というかアクセス制御というか)
View Startup.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc.Authorization;
using Microsoft.AspNetCore.Routing;
You can’t perform that action at this time.