.NET 도움말 C# Linked List (How It Works For Developers) 커티스 차우 업데이트됨:6월 22, 2025 다운로드 IronPDF NuGet 다운로드 DLL 다운로드 윈도우 설치 프로그램 무료 체험 시작하기 LLM용 사본 LLM용 사본 LLM용 마크다운 형식으로 페이지를 복사하세요 ChatGPT에서 열기 ChatGPT에 이 페이지에 대해 문의하세요 제미니에서 열기 제미니에게 이 페이지에 대해 문의하세요 Grok에서 열기 Grok에게 이 페이지에 대해 문의하세요 혼란 속에서 열기 Perplexity에게 이 페이지에 대해 문의하세요 공유하다 페이스북에 공유하기 트위터에 공유하기 LinkedIn에 공유하기 URL 복사 이메일로 기사 보내기 A linked list is a linear data structure composed of a series of nodes, which can also be called elements. Unlike arrays, where elements/nodes are stored in contiguous memory locations, linked lists utilize dynamic memory allocation, allowing elements/nodes to be scattered throughout memory. In its simplest form, "linked lists" consist of nodes linked together linearly. Each node contains two main parts: Data: Payload stored in the node. This can be of any data type depending on the implementation, such as integers, strings, objects, etc. Next Pointer: A reference (or pointer) to the next node in the sequence. This pointer indicates the memory location of the following node points forward in the linked list. The last node in a linked list typically points to a null reference, indicating the end of the list. In this article, we will look in detail at the Linked list in C# and also explore the IronPDF library, a PDF generation tool from Iron Software. Types of Linked Lists 1. Singly Linked List A singly linked list has a node with only one reference, typically pointing to the next node in the sequence. Traversing the list is limited to moving in one direction, typically from the head (the initial node) to the tail (the final node). 2. Doubly Linked List In a doubly linked list, each node contains two references: one pointing to the next node and another pointing to the previous node in the sequence. This bidirectional linkage enables traversal in both forward and backward directions. 3. Circular Linked List In a circular linked list, the last node points back to the first node, forming a circular structure. This type of linked list can be implemented using either singly or doubly linked nodes. Basic Operations on Linked Lists Insertion: Adding a new node to the list at a specific position, such as the beginning, end, or middle. Deletion: Removing a specified object node from the list, and adjusting the pointers of neighboring nodes accordingly. Traversal: Iterating through the list to access or manipulate each node's data. Search: Finding a specific node in the list based on its data-specified value. Linked List in C# In C#, you can implement a linked list using the LinkedList class from the System.Collections.Generic namespace. Here's an example of all the basic operations: using System; using System.Collections.Generic; namespace CsharpSamples { public class Program { public static void Main() { // Create a new linked list of integers LinkedList<int> linkedList = new LinkedList<int>(); // Add elements to the linked list linkedList.AddLast(10); linkedList.AddLast(20); linkedList.AddLast(30); linkedList.AddLast(40); // Traverse and print the elements of the linked list Console.WriteLine("Traverse Linked List elements:"); foreach (var item in linkedList) { Console.WriteLine(item); } // Display number of linked list elements Console.WriteLine($"Number of Linked List elements: {linkedList.Count}"); // Find/Search for an element in the linked list Console.WriteLine("\nFind/Search Element Linked List elements: 30"); var foundNode = linkedList.Find(30); if (foundNode != null) { Console.WriteLine( $"Found Value: {foundNode.Value}, " + $"Next Element: {(foundNode.Next != null ? foundNode.Next.Value.ToString() : "null")}, " + $"Previous Element: {(foundNode.Previous != null ? foundNode.Previous.Value.ToString() : "null")}" ); } // Insert an element at a specified node LinkedListNode<int> current = linkedList.Find(20); if (current != null) { linkedList.AddAfter(current, 25); } Console.WriteLine($"\nNumber of Linked List elements: {linkedList.Count}"); Console.WriteLine("\nLinked List elements after insertion:"); foreach (var item in linkedList) { Console.WriteLine(item); } // Remove an existing node from the linked list linkedList.Remove(30); Console.WriteLine("\nLinked List elements after removal:"); foreach (var item in linkedList) { Console.WriteLine(item); } Console.WriteLine($"\nNumber of Linked List elements: {linkedList.Count}"); } } } using System; using System.Collections.Generic; namespace CsharpSamples { public class Program { public static void Main() { // Create a new linked list of integers LinkedList<int> linkedList = new LinkedList<int>(); // Add elements to the linked list linkedList.AddLast(10); linkedList.AddLast(20); linkedList.AddLast(30); linkedList.AddLast(40); // Traverse and print the elements of the linked list Console.WriteLine("Traverse Linked List elements:"); foreach (var item in linkedList) { Console.WriteLine(item); } // Display number of linked list elements Console.WriteLine($"Number of Linked List elements: {linkedList.Count}"); // Find/Search for an element in the linked list Console.WriteLine("\nFind/Search Element Linked List elements: 30"); var foundNode = linkedList.Find(30); if (foundNode != null) { Console.WriteLine( $"Found Value: {foundNode.Value}, " + $"Next Element: {(foundNode.Next != null ? foundNode.Next.Value.ToString() : "null")}, " + $"Previous Element: {(foundNode.Previous != null ? foundNode.Previous.Value.ToString() : "null")}" ); } // Insert an element at a specified node LinkedListNode<int> current = linkedList.Find(20); if (current != null) { linkedList.AddAfter(current, 25); } Console.WriteLine($"\nNumber of Linked List elements: {linkedList.Count}"); Console.WriteLine("\nLinked List elements after insertion:"); foreach (var item in linkedList) { Console.WriteLine(item); } // Remove an existing node from the linked list linkedList.Remove(30); Console.WriteLine("\nLinked List elements after removal:"); foreach (var item in linkedList) { Console.WriteLine(item); } Console.WriteLine($"\nNumber of Linked List elements: {linkedList.Count}"); } } } $vbLabelText $csharpLabel Code Explanation Create a new linked list of integers using new LinkedList<int>(). Add specified value objects to the linked list. Traverse and print the elements of the linked list using a foreach loop. Find/search for an element in the linked list. Insert an element at a specified node using the Find and AddAfter methods. Remove an existing node from the linked list using the Remove method. Output Introducing IronPDF Discover more about IronPDF is a powerful C# PDF library developed and maintained by Iron Software. It provides a comprehensive set of features for creating, editing, and extracting content from PDF documents within .NET projects. Key Points about IronPDF HTML to PDF Conversion IronPDF allows you to convert HTML content to PDF format. You can render HTML pages, URLs, and HTML strings into PDFs with ease. Rich API The library offers a user-friendly API that enables developers to generate professional-quality PDFs directly from HTML. Whether you need to create invoices, reports, or other documents, IronPDF simplifies the process. Cross-Platform Support IronPDF is compatible with various .NET environments, including .NET Core, .NET Standard, and .NET Framework. It runs on Windows, Linux, and macOS platforms. Versatility IronPDF supports different project types, such as web applications (Blazor and WebForms), desktop applications (WPF and MAUI), and console applications. Content Sources You can generate PDFs from various content sources, including HTML files, Razor views (Blazor Server), CSHTML (MVC and Razor), ASPX (WebForms), and XAML (MAUI). Additional Features Add headers and footers to PDFs. Merge, split, add, copy, and delete PDF pages. Set passwords, permissions, and digital signatures. Optimize performance with multithreading and asynchronous support. Compatibility IronPDF adheres to PDF standards, including versions 1.2 to 1.7, PDF/UA, and PDF/A. It also supports UTF-8 character encoding, base URLs, and asset encoding. Generate PDF Document Using LinkedList Now let's create a PDF document using IronPDF and also demonstrate the usage of LinkedList strings. To start with, open Visual Studio and create a console application by selecting from project templates as shown below. Provide a project name and location. Select the required .NET version. Install IronPDF from the Visual Studio Package manager like the one below. Or it can be installed using the below command line. dotnet add package IronPdf --version 2024.4.2 Add the below code. using System; using System.Collections.Generic; using IronPdf; namespace CsharpSamples { public class Program { public static void Main() { var content = "<h1>Demonstrate IronPDF with C# LinkedList</h1>"; content += "<h2>Create a new linked list of strings</h2>"; content += "<p>Create a new linked list of strings with new LinkedList<string>()</p>"; // Create a new linked list of strings LinkedList<string> linkedList = new LinkedList<string>(); // Add elements to the linked list content += "<p>Add Apple to linkedList</p>"; linkedList.AddLast("Apple"); content += "<p>Add Banana to linkedList</p>"; linkedList.AddLast("Banana"); content += "<p>Add Orange to linkedList</p>"; linkedList.AddLast("Orange"); content += "<h2>Print the elements of the linked list</h2>"; Console.WriteLine("Linked List elements:"); foreach (var item in linkedList) { content += $"<p>{item}</p>"; Console.WriteLine(item); } content += "<h2>Insert an element at a specific position</h2>"; LinkedListNode<string> node = linkedList.Find("Banana"); if (node != null) { linkedList.AddAfter(node, "Mango"); content += "<p>Find Banana and insert Mango After</p>"; } Console.WriteLine("\nLinked List elements after insertion:"); content += "<h2>Linked List elements after insertion:</h2>"; foreach (var item in linkedList) { content += $"<p>{item}</p>"; Console.WriteLine(item); } content += "<h2>Remove an element from the linked list</h2>"; linkedList.Remove("Orange"); content += "<p>Remove Orange from linked list</p>"; Console.WriteLine("\nLinked List elements after removal:"); content += "<h2>Linked List elements after removal:</h2>"; foreach (var item in linkedList) { content += $"<p>{item}</p>"; Console.WriteLine(item); } // Create a PDF renderer var renderer = new ChromePdfRenderer(); // Create a PDF from HTML string var pdf = renderer.RenderHtmlAsPdf(content); // Save to a file pdf.SaveAs("AwesomeIronOutput.pdf"); } } } using System; using System.Collections.Generic; using IronPdf; namespace CsharpSamples { public class Program { public static void Main() { var content = "<h1>Demonstrate IronPDF with C# LinkedList</h1>"; content += "<h2>Create a new linked list of strings</h2>"; content += "<p>Create a new linked list of strings with new LinkedList<string>()</p>"; // Create a new linked list of strings LinkedList<string> linkedList = new LinkedList<string>(); // Add elements to the linked list content += "<p>Add Apple to linkedList</p>"; linkedList.AddLast("Apple"); content += "<p>Add Banana to linkedList</p>"; linkedList.AddLast("Banana"); content += "<p>Add Orange to linkedList</p>"; linkedList.AddLast("Orange"); content += "<h2>Print the elements of the linked list</h2>"; Console.WriteLine("Linked List elements:"); foreach (var item in linkedList) { content += $"<p>{item}</p>"; Console.WriteLine(item); } content += "<h2>Insert an element at a specific position</h2>"; LinkedListNode<string> node = linkedList.Find("Banana"); if (node != null) { linkedList.AddAfter(node, "Mango"); content += "<p>Find Banana and insert Mango After</p>"; } Console.WriteLine("\nLinked List elements after insertion:"); content += "<h2>Linked List elements after insertion:</h2>"; foreach (var item in linkedList) { content += $"<p>{item}</p>"; Console.WriteLine(item); } content += "<h2>Remove an element from the linked list</h2>"; linkedList.Remove("Orange"); content += "<p>Remove Orange from linked list</p>"; Console.WriteLine("\nLinked List elements after removal:"); content += "<h2>Linked List elements after removal:</h2>"; foreach (var item in linkedList) { content += $"<p>{item}</p>"; Console.WriteLine(item); } // Create a PDF renderer var renderer = new ChromePdfRenderer(); // Create a PDF from HTML string var pdf = renderer.RenderHtmlAsPdf(content); // Save to a file pdf.SaveAs("AwesomeIronOutput.pdf"); } } } $vbLabelText $csharpLabel Code Explanation First, we start by creating the content for the PDF, using a content string object. The content is generated as an HTML string. Create a new linked list of strings with new LinkedList<string>(). Add elements to the linked list and also append information to the PDF content string. Print the elements of the linked list and append to the PDF content. Insert an element at a specific position using the AddAfter method; update content and print the resulting list. Remove an element from the linked list using the Remove method, update content, and print the resulting list. Finally, save the generated HTML content string to a PDF document using ChromePdfRenderer, RenderHtmlAsPdf, and SaveAs methods. Output The output has a watermark that can be removed using a valid license from the IronPDF licensing page. IronPDF License The IronPDF library requires a license to run, and it can be obtained from the product licensing page. Paste the key in the appSettings.json file below. { "IronPdf.License.LicenseKey": "The Key Goes Here" } Conclusion C# LinkedList provides a versatile data structure for managing collections of elements, offering efficient insertions and deletions while accommodating dynamic resizing, similar to the default hash function. Linked lists are commonly used in various applications and algorithms, such as implementing stacks, queues, symbol tables, and memory management systems. Understanding the characteristics and operations of linked lists is essential for building efficient and scalable software solutions. In summary, while linked lists excel in certain scenarios, such as dynamic data structures and frequent insertions/deletions, they may not be the best choice for applications requiring frequent random access or dealing with memory-constrained environments. Careful consideration of the specific requirements and characteristics of the data can guide the selection of the most appropriate data structure for the task at hand. The IronPDF library from Iron Software allows developers to create and manipulate PDF documents effortlessly, enabling advanced skills to develop modern applications. 자주 묻는 질문 C#에서 링크된 목록이란 무엇인가요? C#의 링크된 목록은 노드로 구성된 선형 데이터 구조로, 각 노드에는 데이터와 다음 노드에 대한 참조가 포함되어 있습니다. 이 구조는 배열과 달리 동적 메모리 할당이 가능하므로 요소를 인접하지 않은 메모리 위치에 저장할 수 있습니다. C#에서 HTML을 PDF로 변환하려면 어떻게 해야 하나요? IronPDF의 RenderHtmlAsPdf 메서드를 사용하여 HTML 문자열을 PDF로 변환할 수 있습니다. 또한 RenderHtmlFileAsPdf를 사용하여 HTML 파일을 PDF로 변환할 수 있습니다. C#에서 링크된 목록의 유형은 무엇인가요? C#에서 링크된 목록의 주요 유형은 단일 링크된 목록, 이중 링크된 목록 및 순환 링크된 목록입니다. 단일 링크된 목록에는 다음 노드에 대한 단일 참조가 있는 노드가 있고, 이중 링크된 목록에는 다음 노드와 이전 노드에 대한 참조가 있으며, 순환 링크된 목록에는 마지막 노드가 첫 번째 노드를 다시 가리키는 노드가 있습니다. 링크된 목록에서 수행할 수 있는 기본 작업에는 어떤 것이 있나요? 링크된 목록은 삽입(새 노드 추가), 삭제(기존 노드 제거), 순회(목록을 반복), 검색(데이터를 기반으로 노드 찾기)과 같은 작업을 지원합니다. C#에서 링크된 목록을 어떻게 구현하나요? 링크된 목록은 목록의 노드를 추가, 제거 및 조작하는 메서드를 제공하는 System.Collections.Generic 네임스페이스의 LinkedList 클래스를 사용하여 C#에서 구현할 수 있습니다. PDF 생성 라이브러리는 어떤 기능을 제공하나요? IronPDF와 같은 PDF 생성 라이브러리는 다양한 .NET 환경 내에서 HTML을 PDF로 변환, 텍스트 추출, 문서 병합 및 분할, 문서 권한 설정 등의 기능을 제공합니다. 링크된 목록은 PDF 생성에 어떻게 사용할 수 있나요? 링크된 목록은 콘텐츠를 동적으로 저장하고 구성할 수 있으며, 이를 반복하여 IronPDF와 같은 라이브러리를 사용하여 PDF 문서로 변환할 수 있어 콘텐츠 조작 및 출력이 용이합니다. 소프트웨어 개발에서 링크된 목록을 사용하면 어떤 이점이 있나요? 링크된 목록은 효율적인 삽입 및 삭제, 동적 크기 조정 기능을 제공하며 스택 및 대기열과 같은 동적 데이터 구조를 구현하는 데 유용합니다. 무작위 액세스 기능은 없지만 자주 수정해야 할 때 특히 유용합니다. 단일 링크 목록과 이중 링크 목록의 차이점은 무엇인가요? 가장 큰 차이점은 단일 링크 목록에는 다음 노드에 대한 단일 참조가 있는 노드가 있어 단방향 탐색이 가능한 반면, 이중 링크 목록에는 다음 노드와 이전 노드 모두에 대한 참조가 있는 노드가 있어 양방향 탐색이 가능하다는 점입니다. C#의 링크된 목록 데이터에서 PDF를 생성하려면 어떻게 해야 하나요? 링크된 목록을 반복하여 데이터를 수집한 다음 IronPDF의 API를 사용하여 이 데이터를 PDF 문서로 렌더링할 수 있습니다. 여기에는 구조화된 콘텐츠를 전문적인 PDF 형식으로 변환하기 위해 HtmlToPdf와 같은 메서드를 활용하는 것이 포함됩니다. 커티스 차우 지금 바로 엔지니어링 팀과 채팅하세요 기술 문서 작성자 커티스 차우는 칼턴 대학교에서 컴퓨터 과학 학사 학위를 취득했으며, Node.js, TypeScript, JavaScript, React를 전문으로 하는 프론트엔드 개발자입니다. 직관적이고 미적으로 뛰어난 사용자 인터페이스를 만드는 데 열정을 가진 그는 최신 프레임워크를 활용하고, 잘 구성되고 시각적으로 매력적인 매뉴얼을 제작하는 것을 즐깁니다. 커티스는 개발 분야 외에도 사물 인터넷(IoT)에 깊은 관심을 가지고 있으며, 하드웨어와 소프트웨어를 통합하는 혁신적인 방법을 연구합니다. 여가 시간에는 게임을 즐기거나 디스코드 봇을 만들면서 기술에 대한 애정과 창의성을 결합합니다. 관련 기사 업데이트됨 12월 11, 2025 Bridging CLI Simplicity & .NET : Using Curl DotNet with IronPDF Jacob Mellor has bridged this gap with CurlDotNet, a library created to bring the familiarity of cURL to the .NET ecosystem. 더 읽어보기 업데이트됨 12월 20, 2025 RandomNumberGenerator C# Using the RandomNumberGenerator C# class can help take your PDF generation and editing projects to the next level 더 읽어보기 업데이트됨 12월 20, 2025 C# String Equals (How it Works for Developers) When combined with a powerful PDF library like IronPDF, switch pattern matching allows you to build smarter, cleaner logic for document processing 더 읽어보기 C# Reverse String (How It Works For Developers)C# iList (How It Works For Developers)
업데이트됨 12월 11, 2025 Bridging CLI Simplicity & .NET : Using Curl DotNet with IronPDF Jacob Mellor has bridged this gap with CurlDotNet, a library created to bring the familiarity of cURL to the .NET ecosystem. 더 읽어보기
업데이트됨 12월 20, 2025 RandomNumberGenerator C# Using the RandomNumberGenerator C# class can help take your PDF generation and editing projects to the next level 더 읽어보기
업데이트됨 12월 20, 2025 C# String Equals (How it Works for Developers) When combined with a powerful PDF library like IronPDF, switch pattern matching allows you to build smarter, cleaner logic for document processing 더 읽어보기