Common 34 PriorityQueue, Comparator PriorityQueue- 우선 순위 큐로써 요소 삽입시 특정 순서에 따라 큐가 배열되는 자료구조. 예제) PriotiryQueue pq = new PriotiryQueue(); pq.add(5); pq.add(1); pq.add(2); System.out.println(pq.poll()); System.out.println(pq.poll()); System.out.println(pq.poll()); ==>출력 1 2 5 - 매서드 poll() : 큐에서 우선순위가 가장 높은 요소를 빼냅니다. 즉 반환 후에 큐에서 삭제됩니다. peek() : poll과 달리 큐에서 삭제하지 않고 가장 우선순위가 높은 요소를 얻습니다. 2014. 5. 23. Enumerable Class 1 : Enumerable Method - Aggregate Enumerable.Aggregate 메서드 네임스페이스: System.Linq 어셈블리: System.Core(System.Core.dll) 1. public static TSource Aggregate(this IEnumerable source,Func func )예제) string sentence = "천리길도 한 걸음 부터"; // 빈공백으로 각 단어를 words 배열에 담는다. string[] words = sentence.Split(' '); // 단어순서를 바꾸기 위해 새로운 문장의 시작부분에 각 단어를 추가 string reversed = words.Aggregate((workingSentence, next) => next + " " + workingSentence); Console.Wri.. 2014. 5. 22. Enumerable Class 0 IEnumerable 을 구현하는 개체를 쿼리하기 위한 static(Visual Basic의 경우 Shared) 메서드 집합을 제공합니다. 상속 계층 구조System.Object System.Linq.Enumerable 네임스페이스: System.Linq 어셈블리: System.Core(System.Core.dll) 구문public static class Enumerable 설명이 클래스의 메서드는 IEnumerable을 구현하는 데이터 소스를 쿼리하기 위한 표준 쿼리 연산자를 구현합니다. 표준 쿼리 연산자는 LINQ 패턴을 따르며, 모든 .NET 기반 프로그래밍 언어에서 탐색, 필터 및 프로젝션 작업을 나타낼 수 있게 하는 범용 메서드입니다.이 클래스의 메서드는 대부분 IEnumerable을 확장하는 .. 2014. 5. 22. C#을 이용한 NTP Service using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.IO;using System.Net;using System.Net.Sockets; namespace NTPService_Time{ /// /// Static class to receive the time from a NTP server. /// public static class NtpClient { /// /// Gets the current DateTime from time-a.nist.gov. /// /// A DateTime containing the current time. public static DateTime GetNetw.. 2014. 5. 17. 이전 1 ··· 5 6 7 8 9 다음