Theory
Button मत Build कीजिए
ShopKeeper को क्या-क्या चाहिए इसके बारे में सोचिए: windows, buttons, textboxes, एक bill grid, file saving, एक database connection, date handling, string cleanup।
Scratch से एक button लिखना (pixels draw करना, clicks track करना, hover पर repaint करना) आपको एक महीना लेता। और यह YOUR button होता, YOUR bugs के साथ।
Microsoft पहले ही button लिख चुका है। और grid, file reader, connection। .NET का दूसरा pillar वह warehouse है: Framework Class Library।
Theory
Library, Formally
.NET Framework Class Library (FCL) reusable classes, interfaces और types का एक comprehensive, object-oriented collection है, हर .NET language को identically available।
इसका organising system namespace है: एक dotted, hierarchical name जो related classes group करता है, exactly BCA403 के Java packages जैसा।
Systemroot है: everyday types यहाँ रहते हैंSystem.Windows.Formsdesktop UI classes hold करता हैSystem.Datadatabase machinery hold करता है
Gehre dots का मतलब है एक ज़्यादा specialised shelf, बस इतना।
At a glance
वे Shelves जिन्हें ShopKeeper Visit करेगा
| Namespace | Shelf पर क्या है | ShopKeeper Use |
|---|---|---|
| System | Object, String, Int32, Math, Console | Code की हर line |
| System.Windows.Forms | Form, Button, TextBox, DataGrid | Billing screen (Unit 3) |
| System.Data | Connection, Command, DataSet | Bills save करना (Unit 5) |
| System.IO | File, StreamReader, StreamWriter | एक दिन की report export करना |
| System.Collections | ArrayList और friends | एक bill में items की list (Unit 2) |
Practical
Imports एक Shelf खोलता है
' Without Imports: full names everywhere
Dim box1 As System.Windows.Forms.TextBox
' With Imports at the top of the file:
Imports System.Windows.Forms
Public Class BillingForm
Dim box2 As TextBox ' short name now works
Dim total As Integer ' Integer IS System.Int32 underneath
Sub Greet()
MsgBox("Welcome to ShopKeeper")
End Sub
End Class
Quiz
ShopKeeper को अपनी Form, Button और TextBox classes के लिए किस namespace में पहुँचना चाहिए?
- System.Windows.Forms
- System.Data
- System.IO
- Microsoft.VisualStudio
Show the answer
System.Windows.Forms
Desktop UI System.Windows.Forms shelf पर रहता है; Unit 3 essentially इसका एक guided tour है। System.Data Unit 5 की database machinery है, System.IO files और streams है। Microsoft.VisualStudio trap है: Visual Studio वह IDE है जिसमें आप बैठते हैं, और आपका running program इस पर depend नहीं करता; tool को library से confuse करना recurring Unit 1 mistake है।
Think first
Integer असल में क्या है?
VB.NET Dim total As Integer लिखता है, C# int total लिखता है। कल के lesson ने कहा दोनों languages एक type system share करती हैं। Tap करने से पहले: Integer underneath क्या है, और यह क्यों matter करता है?
Show the answer
Integer System.Int32 का एक alias है, एक class-library type; C# का int SAME System.Int32 है। हर language का keyword-type एक FCL type पर map होता है: String System.String है, Boolean System.Boolean है। यही CTS concrete बनाया गया है: languages एक warehouse से borrow करके types share करती हैं। एक consequence जो आप constantly इस्तेमाल करेंगे: Integer के पास METHODS हैं (total.ToString()), क्योंकि underneath यह कभी एक bare C-style int था ही नहीं।
Watch out
Library Confusions जो Marks खोते हैं
FCL बनाम CLR: library parts है, CLR engine है। "Class library MSIL execute करती है" 0 score करता है।
Imports Code Load नहीं करता: Java के import की तरह, यह बस short names लिखने देता है; assembly reference actual linking करता है।
Namespace बनाम Class: System.Windows.Forms एक namespace है; Form इसके अंदर एक class है। "Form namespace" लिखना examiner को बताता है आपने कभी IDE touch नहीं किया।
Theory
Unit 1, एक Breath में
अब आप पूरी machine recite कर सकते हैं: VB.NET source एक assembly में MSIL + metadata में compile होता है; CLR इसे load, verify, JIT-compile और garbage-collect करता है; और code खुद namespaces के ज़रिए reach किए गए FCL classes से largely assembled है। इसे दो बार कहिए; यह 4 अलग exam questions answer करता है। अगला lesson आख़िरकार Visual Studio खोलता है और वह room दिखाता है जहाँ ShopKeeper build होता है।
Summary
Key takeaways
- FCL .NET की ready-made classes की library है, सारी .NET languages से identically shared।
- Namespaces इसे hierarchically organise करते हैं: root पर System, specialisation के लिए dots।
- Key shelves: System (core types), System.Windows.Forms (UI), System.Data (ADO.NET), System.IO (files), System.Collections।
- Imports short names के लिए scope में एक namespace लाता है, Java के import जैसा।
- VB.NET का Integer/String FCL types (System.Int32, System.String) के aliases हैं: practice में CTS।
- Library = parts, CLR = engine; एक answer में कभी इनके jobs swap मत कीजिए।
- Memory hook: वह मत बनाइए जो warehouse पहले से stock करता है।