C# Code Snippets: Common Tasks and Best Practices

Reflection and Type Information

D.

Type t = Type.GetType("CompanyClass");
MethodInfo m = t.GetMethod("MyMethod");
int i = (int)m.Invoke(this, new object[] { 1 });

D. Call the IsFamily property of the MethodInfo class.

Culture-Specific Formatting

B.

NumberFormatInfo culture = new CultureInfo("zh-HK").NumberFormat;
culture.CurrencyNegativePattern = 1;
return numberToPrint.ToString("c", culture);

A.

DateTimeFormatInfo dtfi = new CultureInfo("es-MX", false).DateTimeFormat;
DateTime dt = new DateTime(DateTime.
Read More

Database Management Systems: Concepts and Best Practices

Key Definitions

  • Data: Information that a computer stores and records.
  • Record: Discrete piece of information in a register.
  • Registration: Information related to a product, event, or person.
  • File or Data File: A collection of related information, stored like a file. A file is a set of records.
  • Query: The search for a specific record or a request to select records that meet a set of criteria. There are select, delete, table creation, and update queries.
  • Report: Ordered list of selected fields and records
Read More

Software Development: From Requirements to Deployment

Requirements Engineering Process: Key Steps

Requirements Elicitation

  • Purpose: To gather requirements from stakeholders.
  • Activities:
    • Conduct interviews, surveys, and workshops.
    • Observe existing systems or workflows.
    • Develop use cases and scenarios to understand functional requirements.
  • Importance: Ensures all user and system requirements are identified early.
  • Challenges:
    • Ambiguity: Requirements like “user-friendly” are unclear.
    • Conflicts: Stakeholders may have differing priorities.
  • Resolution: Use structured
Read More

Internet: Protocols, History, Services, and Security

Internet

The Internet is a worldwide network consisting of devices that communicate with each other using a language called a protocol. The primary purpose of this protocol is the exchange of information.

What do we need to use the Internet?

  • Computer
  • Internet: A software tool that lets you view web pages (service provider ISP).
  • Browser
  • Modem or Router:
    • Modem: A modulator and demodulator which is responsible for converting digital signals to analog and vice versa.
    • Router: A device responsible for determining
Read More

Essential PC Components: Motherboard, CPU, RAM, and More

Motherboard: The Foundation of Your PC

The motherboard is an integrated circuit that serves as the central hub of the computer. It synchronizes all components via buses. Key components include the processor socket, expansion slots, RAM slots, IDE, and SATA connectors. The motherboard features two chipsets: Northbridge and Southbridge.

  • Northbridge manages communication between the RAM and the graphics processor.
  • Southbridge controls the peripheral ports.

The BIOS, a chip on the motherboard, handles system

Read More

Linux Operating System: Features and Evolution

Introduction to Operating Systems

An Operating System (OS) is a program (or set of programs) designed to facilitate computer use and ensure efficient operation. It acts as a control program, managing and allocating resources.

Evolution of Operating Systems

  • Stage I (1943-1955): No operating systems existed. The programmer also assumed the operator’s role, manually inputting the program and receiving output via a printer. Assemblers were later introduced.
  • Stage II (1956-1963): Introduction of intermediate
Read More