분류 전체보기
-
[C#] C# Collection | Immutable CollectionC#(asp.net | asp.net core) 2021. 8. 11. 17:37
Hashtable arr5 = new(); arr5["aaa"] = 111; arr5["bbb"] = 222; arr5["ccc"] = 333; foreach (DictionaryEntry kkk in arr5) WriteLine($"Key : {kkk}, Value:{kkk.Value}"); WriteLine(); // ---------------------------------------- Dictionary arr6 = new(); arr6["aaa"] = 111; arr6["bbb"] = 222; arr6["ccc"] = 333; foreach (var kkk in arr6) WriteLine($"Key : {kkk}, Value:{kkk.Value}"); WriteLine(); // ------..
-
[C#] IEnumerator | LINQ service 사용해서 문자열 출력C#(asp.net | asp.net core) 2021. 8. 11. 11:17
C#에서 문자열을 IEnumerator, LINQ로 접근할 수 있다 IEnumerator 사용법 우선 문자열을 하나 선언해보자 string strS = $"Hello, World!"; 문자열을 출력하는 코드이다 IEnumerator pointer = strS.GetEnumerator(); while (pointer.MoveNext()) { Write(pointer.Current); } 문자열인 집합 데이터셋의 Array를 반환한다 Array의 접근 방법은 pointer.MoveNext() 하면 다음 문자열로 넘어가고 pointer.Current하면 현재값에 접근할 수 있다 LINQ LINQ를 사용하면 더욱 간단하게 문자열 출력할 수 있다 strS.ToList().ForEach(kkk=>Write(kkk));
-
[C#] functional coding | callbackC#(asp.net | asp.net core) 2021. 8. 10. 17:20
int One() => 1; int Two() => 2; int Three() => 3; int Four() => 4; int Five() => 5; int Six() => 6; int Seven() => 7; int Eight() => 8; int Nine() => 9; int Ten() => 10; // javascript/dynamic program Func TenAddFunc = AddCalc(Ten()); Func TenSubFunc = SubCalc(Ten()); Func TenMulFunc = MulCalc(Ten()); Func TenDivFunc = DivCalc(Ten()); Func FiveAddFunc = AddCalc(Five()); Func FiveSubFunc = SubCalc..
-
MVC Pattern 자동 생성 프로젝트 - New Scaffolded ItemC#(asp.net | asp.net core) 2021. 8. 10. 14:34
MVC Application 생성 후 1. Model을 생성한다 using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace WebApplication1.Models { // Table=Entity (tuple의 집합) public class Saram { public int Id { get; set; } = default(int); public int Age { get; set; } = default(int); public string Name { get; set; } = default(string); public bool Gender { get; set; } = defau..
-
C# state operation | record 사용법C#(asp.net | asp.net core) 2021. 8. 9. 16:45
C#에서 record를 가지고 state operation에 대해 알아보겠다 우선 record를 생성해보자 public record Person(string FirstName, string LastName); Person 객체를 생성해보자 Person person = new Person("minsu", "kim"); 이 person 객체를 사용해서 person2를 생성해보자 Person person2 = person with {FirstName = "aaa"}; person과 person2는 같은 객체일까? 답은 true이다 person의 FirstName이라는 state를 변경하고 person 객체를 person2에 저장하였기 때문에 동일하다 person과 person2의 FirstName 을 보면 "..
-
spring security - Authentication, UserDetails, OAuth2User / 예시JAVA/Spring(Springboot) 2021. 8. 8. 20:47
Spring Security를 사용하여 로그인하는 경우에는 Session영역에 Authentication 정보를 저장해둔다. Authentication 은 컨트롤러 등에서 User에 대한 정보를 가져올 때 사용이 되는데, 사용자가 로그인 한 방식에 따라서 Authentication의 구현체가 달라진다. - UserDetails : 사용자가 일반적(id, pw입력)으로 로그인 한 경우 - OAuth2User : Auth 로그인 한 경우 (ex- 구글, 카카오 등) 그럼 컨트롤러에서 session에 담긴 사용자 정보를 들고 올때 로그인 방식에 상관없이 한 번에 가져올 수 있는 방법이 있을까? 답은 가능하다! 보통 SpringSecurity로 로그인을 구현할 때 UserDetails 를 먼저 구현하는 경우가 ..
-
git 에 있는 프로젝트 Intellij 에 clone 하기JAVA/Spring(Springboot) 2021. 8. 4. 23:02
Intellij에서 Github의 Spring Gradle Project import 하기 (daddyprogrammer.org) Intellij에서 Github의 Spring Gradle Project import 하기 Intellij에서 Github의 Spring Project를 로컬로 Clone 하여 프로젝트를 구성하는 방법에 대해 알아보겠습니다. 참고로 Gradle로 구성된 SpringBoot 기준입니다. Github 프로젝트 주소 복사 Github로 이동하여 clone daddyprogrammer.org 이클립스로 git clone 진행하다가 External Project and Library 를 못 가져와 하루종일 삽질하다가,,, IntelliJ 에 Clone 하니까 바로 되었다.... 어후 ..