NET Framework
Total Page:16
File Type:pdf, Size:1020Kb
.NET Framework #.net 1 1: .NET Framework 2 2 2 . 2 Compact Framework 2 3 Examples 3 C # Hello World 3 Visual Basic .NET Hello World 3 Hello World in F # 4 C ++ / CLI Hello World 4 PowerShell Hello World 4 Nemerle 4 Oxygene 4 Boo Hello World 5 Hello World in Python (IronPython) 5 IL 5 2: .NET 6 6 6 Examples 6 6 3: .NET JSON Newtonsoft.Json 7 7 Examples 7 JSON 7 JSON . 7 4: ADO.NET 8 8 8 Examples 8 SQL 8 - SQL 8 ADO.NET 9 . 10 5: ASP.NET ASP.NET MVC 11 11 Examples 11 11 6: C # SHA1 13 13 Examples 13 # SHA1 13 7: C # SHA1 14 14 Examples 14 # SHA1 14 # 14 8: CLR 15 Examples 15 15 9: DateTime 16 Examples 16 ParseExact 16 TryParse 17 TryParseExact 18 10: HTTP 19 Examples 19 HTTP (HttpListener) 19 HTTP (ASP.NET ) 21 11: HTTP 23 23 Examples 23 System.Net.HttpWebRequest GET 23 System.Net.WebClient GET 23 System.Net.HttpClient GET 24 System.Net.HttpWebRequest POST 24 System.Net.WebClient POST 24 System.Net.HttpClient POST 25 System.Net.Http.HttpClient HTTP 25 12: JIT 27 27 27 Examples 27 27 13: JSON 30 30 Examples 30 System.Web.Script.Serialization.JavaScriptSerializer 30 Json.NET 30 Json.NET 30 - Newtonsoft.Json 31 31 JsonSerializerSettings Json.NET 32 14: LINQ 33 33 33 39 39 ToArray() ToList() ? 39 Examples 39 () 40 () 40 40 OrderByDescending 40 41 41 41 41 () 41 42 42 LastOrDefault 42 SingleOrDefault 42 FirstOrDefault 43 43 44 SelectMany () 44 45 45 45 SequenceEqual 45 46 OfType 46 46 46 46 47 47 GroupBy 47 ToDictionary 48 49 ToArray 49 ToList 49 49 49 ElementAtOrDefault 50 SkipWhile 50 TakeWhile 50 DefaultIfEmpty 50 () 51 51 52 53 54 54 54 55 55 55 15: NuGet 57 57 Examples 57 NuGet 57 UI 58 58 58 59 59 59 (MyGet, Klondike ) 59 UI () Nuget 59 61 16: ReadOnlyCollections 62 62 ReadOnlyCollections ImmutableCollection 62 Examples 62 ReadOnlyCollection 62 62 LINQ 62 62 ReadOnlyCollection 62 : ReadOnlyCollection . 63 17: StdErr 64 Examples 64 . 64 64 18: System.IO 65 Examples 65 StreamReader 65 System.IO.File / 65 System.IO.SerialPorts 66 66 System.IO.SerialPort 66 SerialPort / 66 19: System.IO.File 68 68 68 Examples 68 68 69 69 ""( ) 69 . 70 70 File.Move 70 20: System.Net.Mail 72 72 Examples 72 MailMessage 72 73 21: System.Reflection.Emit 74 Examples 74 74 22: System.Runtime.Caching.MemoryCache (ObjectCache) 77 Examples 77 () 77 System.Runtime.Caching.MemoryCache (ObjectCache) 77 23: TPL 79 79 79 Post SendAsync 79 Examples 79 ActionBlock . 79 79 BufferBlock / 80 Bounded BufferBlock 80 24: VB 82 Examples 82 VB.NET Forms Hello World 82 82 82 25: XmlSerializer 85 85 Examples 85 85 85 : 85 : (XmlArray) 85 : DateTime 86 serializer 86 86 ? 86 86 88 26: Zip 89 89 89 Examples 89 ZIP 89 ZIP 89 ZIP 90 27: 91 91 Examples 91 91 IEnumerable 91 28: 93 93 Examples 93 () 93 () 94 () 94 29: 96 96 Examples 96 TCP (TcpListener, TcpClient, NetworkStream) 96 SNTP (UdpClient) 97 30: 99 Examples 99 MSTest 99 99 31: 100 100 Examples 100 100 32: 101 101 Examples 101 UI 101 33: 102 102 Examples 102 102 SafeHandle 102 34: 104 104 Examples 104 104 104 105 105 105 : 106 UTF-8 . 106 UTF-8 106 106 Object.ToString () 106 107 omparing strings 107 35: 108 Examples 108 ? 108 Reflection T 108 108 ( ) enum 109 109 36: 111 111 Examples 111 111 Structs System.ValueType . 111 111 System.Object . 111 Enum 112 . enum System.Enum . 112 37: 114 Examples 114 114 114 114 115 Case-Insensivitve . 115 (.NET 4.0) 115 115 115 116 116 IEnumerable ( .NET 3.5) 116 117 ContainsKey (TKey) 117 118 ConcurrentDictionary Lazy'1 . 118 118 118 38: 120 Examples 120 .NET 1.x ConfigurationSettings AppSettings 120 120 .NET 2.0 ConfigurationManager AppSettings 120 Visual Studio 121 122 123 39: 124 Examples 124 124 40: 126 126 Examples 126 126 126 41: SpeechRecognitionEngine 128 128 128 128 Examples 128 128 129 42: 130 Examples 130 130 130 CMD 130 43: 133 133 133 Examples 133 () 133 - 134 134 134 () 135 136 44: / 138 138 Examples 138 Rijndael Managed 138 AES (C # ) 139 / SALT (C #) 142 (AES) 144 45: 146 146 Examples 146 146 finally 146 catch 147 148 catch 148 . 149 46: 150 Examples 150 .Net 150 47: 151 151 Examples 151 - 151 152 (IoC ) 153 48: (TPL) 155 155 155 Examples 155 - (BlockingCollection) 155 : 156 : WaitAll 156 : WaitAny 156 : (Wait ) 157 : ( ) 157 : CancellationToken 158 Task.WhenAny 159 Task.WhenAll 159 Parallel.Invoke 159 Parallel.ForEach 160 Parallel.For 160 AsyncLocal 160 VB.NET Parallel.ForEach 161 : 161 49: (TPL) API 163 163 Examples 163 UI 163 50: (System.Text.RegularExpressions) 164 Examples 164 . 164 164 164 164 . 164 165 165 165 165 51: 166 Examples 166 166 166 166 166 167 52: IProgress 169 Examples 169 169 IProgress 169 53: 170 170 Examples 170 170 171 172 174 54: 175 175 Examples 175 175 175 175 176 55: POST 179 Examples 179 WebRequest 179 56: / 181 181 181 Examples 181 VB WriteAllText 181 VB StreamWriter 181 C # StreamWriter 181 C # WriteAllText () 181 C # File.Exists () 181 57: 183 183 Examples 183 C # 183 == 183 184 InvocationExpression 184 58: 187 187 187 Examples 187 187 188 59: 189 189 Examples 189 Win32 dll 189 Windows API 189 189 189 191 193 You can share this PDF with anyone you feel could benefit from it, downloaded the latest version from: -net-framework It is an unofficial and free .NET Framework ebook created for educational purposes. All the content is extracted from Stack Overflow Documentation, which is written by many hardworking individuals at Stack Overflow. It is neither affiliated with Stack Overflow nor official .NET Framework. The content is released under Creative Commons BY-SA, and the list of contributors to each chapter are provided in the credits section at the end of this book. Images may be copyright of their respective owners unless otherwise specified. All trademarks and registered trademarks are the property of their respective company owners. Use the content presented in this book at your own risk; it is not guaranteed to be correct nor accurate, please send your feedback and corrections to [email protected] https://riptutorial.com/ko/home 1 1: .NET Framework .NET Framework Microsoft . .NET MSIL (Microsoft Intermediate Language) . MSIL (CLR) . .NET Framework "Hello World" . "Hello World" "Hello World" . , . .NET . 1.0 2002-02-13 1.1 2003-04-24 2.0 2005-11-07 3.0 2006-11-06 3.5 2007-11-19 3.5 SP1 2008-08-11 4.0 2010-04-12 4.5 2012-08-15 4.5.1 2013-10-17 4.5.2 2014-05-05 4.6 2015-07-20 4.6.1 2015-11-17 4.6.2 2016-08-02 4.7 2017-04-05 Compact Framework 1.0 2000-01-01 2.0 2005-10-01 https://riptutorial.com/ko/home 2 3.5 2007-11-19 3.7 2009-01-01 3.9 2013-06-01 4.2 2011-10-04 4.3 2012-12-04 4.4 2015-10-20 Examples C # Hello World using System; class Program { // The Main() function is the first function to be executed in a program static void Main() { // Write the string "Hello World to the standard out Console.WriteLine("Hello World"); } } Console.WriteLine . "Hello World" "Hello World" . .ToString . .NET Framework . .NET Fiddle C # Visual Basic .NET Hello World Imports System Module Program Public Sub Main() Console.WriteLine("Hello World") End Sub End Module .NET Fiddle Visual Basic .NET https://riptutorial.com/ko/home 3 Hello World in F # open System [<EntryPoint>] let main argv = printfn "Hello World" 0 .NET Fiddle F # C ++ / CLI Hello World using namespace System; int main(array<String^>^ args) { Console::WriteLine("Hello World"); } PowerShell Hello World Write-Host "Hello World" PowerShell Nemerle System.Console.WriteLine("Hello World"); Oxygene namespace HelloWorld; interface type App = class public class method Main(args: array of String); end; implementation class method App.Main(args: array of String); begin Console.WriteLine('Hello World'); end; end. https://riptutorial.com/ko/home 4 Boo Hello World print "Hello World" Hello World in Python (IronPython) print "Hello World" import clr from System import Console Console.WriteLine("Hello World") IL .class public auto ansi beforefieldinit Program extends [mscorlib]System.Object { .method public hidebysig static void Main() cil managed { .maxstack 8 IL_0000: nop IL_0001: ldstr "Hello World" IL_0006: call void [mscorlib]System.Console::WriteLine(string) IL_000b: nop IL_000c: ret } .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { .maxstack 8 IL_0000: ldarg.0 IL_0001: call instance void [mscorlib]System.Object::.ctor() IL_0006: ret } } .NET Framework : https://riptutorial.com/ko/dot-net/topic/14/-net-framework- https://riptutorial.com/ko/home 5 2: .NET .NET Core Microsoft GitHub .NET . Windows, macOS Linux , / IoT . .NET Core ( , , , ) . Microsoft . .NET Core , ( ) . .NET Core . • ASP.NET • Windows 10 Windows (UWP) • Xamarin.Forms .NET Core .NET .NET . .NET .NET .NET API API . .NET .NET .NET . Examples public class Program { public static void Main(string[] args) { Console.WriteLine("\nWhat is your name? "); var name = Console.ReadLine(); var date = DateTime.Now; Console.WriteLine("\nHello, {0}, on {1:d} at {1:t}", name, date); Console.Write("\nPress any key to exit..."); Console.ReadKey(true); } } .NET : https://riptutorial.com/ko/dot-net/topic/9059/-net- https://riptutorial.com/ko/home 6 3: .NET JSON Newtonsoft.Json NuGet Newtonsoft.Json .NET JSON . Examples JSON using Newtonsoft.Json; var obj = new Person { Name = "Joe Smith", Age = 21 }; var serializedJson = JsonConvert.SerializeObject(obj); JSON : {"Name":"Joe Smith","Age":21} JSON .