본문 바로가기

c#109

C# Eager Operator와 단락 연산자 Eager Operator, 단락 연산자(Short-circuit Operatoer) C# 관련으로 공부하다보니 단락 연산자(short-circuit operator)라는 단어를 발견해서 그에 대한 정리를 해보려고 한다. Eager operator는 어떻게 번역되는지 모르겠네요! 아시는 분이 있다면 댓글 부탁드립니다. 심볼(Symbol) 연산자 타입 속성 &, | 논리 연산자, 비트 연산자 Eager operator &&, || 논리 조건 연산자 Short-circuit operator eager operator는 첫 번째 조건과 상관없이 두 번째 조건을 실행한다. eager operator는 비트 연산자(bit operator)와 모양이 같지만 조건 결과가 boolean이면 eager operator로.. 2023. 1. 27.
C# 간단하게 Json 형식 파싱하기 간단하게 C#으로 Json 형식 파싱하기웹 관련으로 일을 하다보면 Json을 많이 접하겠지만 웹과 거리가 있다보면 Json을 다루는 일은 많지 않다고 생각된다. 간단하게 C#의 System.Text.Json을 이용해서 Json을 파싱해보자. using System;using System.Text.Json;namespace JsonTestProject{ public class Program { public class JsonString { public class ServerStatus { public string instanceId { get; set; } public int g.. 2023. 1. 26.
JQuery 사용해서 HTML에서 Controller Actions 호출하는 방법 MVC 코드를 작성하다보면 어쩔 수 없이 JQuery를 사용하게 되는데 이때 유용한 코드를 살펴보자. $.get() $.post() $.get() 매소드 a. 인자를 전달하지 않는 경우 Controller public string SaveEmployeeRecord() { string res = "this is return value"; // do here some operation return res; } View $.get("/Home/SaveEmployeeRecord",null, function (data) { alert(data); }); b. 인자를 전달하는 경우 Controller public string SaveEmployeeRecord(string name) { string res = nam.. 2023. 1. 26.
C# 연산자(Operators) 연산자(Operators) 산술 연산자 부울 논리 연산자 비트 연산자 같음 연산자 비교 연산자 멤버 엑세스 연산자 형식 테스트 연산자 사용자 정의 변환 연산자 산술 연산자(Arithmetic operators) 단항 연산자(Unary operator) ++ (increment) -- (decrement) + (plus) - (minus) 이진 연산자(Binary operator) + 더하기 (addition) - 뺴기 (subtraction) * 곱하기 (multiplication) / 나누기(division) % 나머지 (remainder) 산술 연산자 - C# 참조 - C# 숫자 형식이 포함된 곱하기, 나누기, 나머지, 더하기 및 빼기 작업을 수행하는 C# 연산자에 대해 알아봅니다. learn.mic.. 2023. 1. 25.
C# 가변(Mutable)과 불변(Immutable) 타입에 대하여 가변 타입과 불변 타입에 대해서 글자 그대로 변화가 가능한지(can change) 혹은 불가능 한지(can not change)를 표현한다. 그렇다면 어떤 게 변하고 어떤 게 변하지 않는다는 것일까? 가변(Mutable) - 동일한 메모리 주소에 값 다시 쓰기가 가능하다. 같은 메모리 주소에 값을 넣는다. 불변(Immutable) - 동일한 메모리 주소에 값 다시 쓰기가 불가능. 매번 새로운 메모리 주소에 값을 넣는다. - 가변 타입 예시 StringBuilder - 불변 타입 예시 String - 가변, 불변 타입 선택 가능 C# 기본 타입(Primitive Type)들 (int, byte, short, bool, float 등등) 사용자 정의 Class 보통 String과 StringBuilder의 .. 2023. 1. 25.
C# 얕은 복사(Shallow Copy), 깊은 복사(Deep Copy) 얕은 복사, 깊은 복사에 대해서얕은 복사(Deep Copy) class Point{ public int x; public int y; public Point(int x, int y) { this.x = x; this.y = y; } public overri.. 2023. 1. 18.