개발 공부 25

[C# 기초] Dictionary(매개변수, 네임스페이스, 선언, foreach)

Dictionary 클래스 Dictionary - 키와 값의 컬렉션을 나타낸다. - 매개변수 TKey: Dictionary Key의 형식(Type) TValue: Dictionary Value의 형식(Type) - 네임스페이스 System.Collections.Generic; - Dictionary 선언방법 Dictionary 오브젝트명 = new Dictionary() //Dictionary 클래스를 인스턴스화하여 변수 a에 대입 const a = new Dictionary(); //선언, 정의, 초기화 동시에 const Obj = new Dictionary() { {key0, value0}, {key1, value1}. ... }; - 요소 추가 오브젝트명.Add("Key", "Value"); → A..

[C# 기초] 네임스페이스(namespace), using 지시문

1) namespace 관련 개체 집합을 포함하는 범위를 선언. namespace로 클래스 그룹을 분류. 2) using 지시문 네임스페이스에 정의된 형식을 해당 형식의 정규화된 네임스페이스를 지정하지 않고도 사용할 수 있다. → 단일 namespace에서 모든 형식을 가지고 온다. - using System : System 네임스페이스를 현재 CS 파일 또는 네임스페이스에서 사용한다. ex) using PC.MyCompany → PC라는 namespace와 중첩된 MyCompany라는 namespace를 사용할 수 있다. using System; namespace First { //중첩된 namespace namespace A { class ClassOfFirst { public void Print()..

[Javascript 기본] 간단한 시계 구현 코드

현재 시간을 다음과 같이 시:분:초로 나타내는 시계를 구현한다. index.html 코드 clock.js 코드 const clock = document.querySelector("h2#clock"); function getClock() { const date = new Date(); const hours = String(date.getHours()).padStart(2, "0"); const minutes = String(date.getMinutes()).padStart(2, "0"); const seconds = String(date.getSeconds()).padStart(2, "0"); clock.inerText = `${hours}:${minutes}:${seconds}`; } getClock()..

[Javascript 기본] 간단한 시계 구현(Date 객체, getHours(), getMinutes(), getSeconds(), padStart(), setInterval())

Date 객체 const date = new Date(); → 매 순간 변화하는 시간과 날짜에 관한 정보를 제공한다. new 연산자를 사용한다. 매개변수가 없을 시 생성 순간의 날짜와 시간을 나타내는 Date 객체를 생성한다. Date 메서드 모든 Date 인스턴스는 Date.prototype으로부터 메서드와 프로퍼티를 상속받는다. getHours() - 현재 시각에 해당하는 숫자(0 ~ 23) 반환. getMinutes() - 현재 시각의 분에 해당하는 숫자(0 ~ 59) 반환. getSeconds() - 현재 시각의 초에 대당하는 숫자(0 ~ 59) 반환. 그 외 메서드 ↓ 더보기 getDate() - 현재 일자에 해당하는 숫자(1 ~ 31) 반환. getDay() - 현재 요일에 해당하는 숫자(0 ..

728x90
반응형