The .NET Framework class Library

The class library is .NET's organised warehouse of ready-made classes, arranged in dotted namespaces: System at the root, Windows.Forms for UI, Data for databases, IO for files.

9 min read · 9 cards · 2 checks

Read in: English · हिन्दी · ગુજરાતી


Theory

Do not build the button

Think about everything ShopKeeper needs: windows, buttons, textboxes, a bill grid, file saving, a database connection, date handling, string cleanup.

Writing a button from scratch (drawing pixels, tracking clicks, repainting on hover) would take you a month. And it would be YOUR button, with YOUR bugs.

Microsoft already wrote the button. And the grid, the file reader, the connection. The second pillar of .NET is that warehouse: the Framework Class Library.

Theory

The library, formally

The .NET Framework Class Library (FCL) is a comprehensive, object-oriented collection of reusable classes, interfaces and types, available identically to every .NET language.

Its organising system is the namespace: a dotted, hierarchical name that groups related classes, exactly like BCA403's Java packages.

  • System is the root: the everyday types live here
  • System.Windows.Forms holds the desktop UI classes
  • System.Data holds the database machinery

Deep dots mean a more specialised shelf, nothing more.

At a glance

The shelves ShopKeeper will visit

NamespaceWhat is on the shelfShopKeeper use
SystemObject, String, Int32, Math, ConsoleEvery line of code
System.Windows.FormsForm, Button, TextBox, DataGridThe billing screen (Unit 3)
System.DataConnection, Command, DataSetSaving bills (Unit 5)
System.IOFile, StreamReader, StreamWriterExporting a day's report
System.CollectionsArrayList and friendsThe list of items in a bill (Unit 2)

Practical

Imports opens a 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

Which namespace must ShopKeeper reach into for its Form, Button and TextBox classes?

  1. System.Windows.Forms
  2. System.Data
  3. System.IO
  4. Microsoft.VisualStudio
Show the answer

System.Windows.Forms

Desktop UI lives on the System.Windows.Forms shelf; Unit 3 is essentially a guided tour of it. System.Data is the database machinery for Unit 5, System.IO is files and streams. Microsoft.VisualStudio is the trap: Visual Studio is the IDE you sit in, and your running program does not depend on it; confusing the tool with the library is the recurring Unit 1 mistake.

Think first

What is Integer, really?

VB.NET writes Dim total As Integer, C# writes int total. Yesterday's lesson said both languages share one type system. Before tapping: what is Integer underneath, and why does that matter?

Show the answer

Integer is an alias for System.Int32, a class-library type; C#'s int is the SAME System.Int32. Every language keyword-type maps onto one FCL type: String is System.String, Boolean is System.Boolean. That is the CTS made concrete: languages share types by all borrowing from one warehouse. Consequence you will use constantly: Integer has METHODS (total.ToString()), because underneath it was never a bare C-style int at all.

Watch out

Library confusions that cost marks

FCL vs CLR: the library is the parts, the CLR is the engine. "The class library executes MSIL" scores 0.

Imports does not load code: like Java's import, it only lets you write short names; the assembly reference does the actual linking.

Namespace vs class: System.Windows.Forms is a namespace; Form is a class inside it. Writing "the Form namespace" tells the examiner you never touched the IDE.

Theory

Unit 1 in one breath

You can now recite the whole machine: VB.NET source compiles to MSIL + metadata in an assembly; the CLR loads, verifies, JIT-compiles and garbage-collects it; and the code itself is largely assembled from FCL classes reached through namespaces. Say it twice; it answers 4 different exam questions. Next lesson you finally open Visual Studio and meet the room where ShopKeeper gets built.

Summary

Key takeaways

  • The FCL is .NET's library of ready-made classes, shared identically by all .NET languages.
  • Namespaces organise it hierarchically: System at the root, dots for specialisation.
  • Key shelves: System (core types), System.Windows.Forms (UI), System.Data (ADO.NET), System.IO (files), System.Collections.
  • Imports brings a namespace into scope for short names, like Java's import.
  • VB.NET's Integer/String are aliases for FCL types (System.Int32, System.String): the CTS in practice.
  • Library = parts, CLR = engine; never swap their jobs in an answer.
  • Memory hook: never build what the warehouse already stocks.

Study this properly

This page is the lesson to read. In Gri-Learn the same topic is a graded deck: the self-checks are scored and your weak topics are tracked. Free to start.

Start this topic

Already have an account? Sign in

More from Overview of Microsoft .NET Framework

Gri-Learn · syllabus-mapped B.C.A. lessons in English, Hindi and Gujarati

The .NET Framework class Library · .NET Programming · Gri-Learn