Core Library API Reference
Introduction
The Core Library provides fundamental classes, functions, and data structures that form the backbone of the MSDN platform. It offers essential utilities for everyday programming tasks, ensuring consistency and efficiency across your applications.
This documentation details the various components of the Core Library, including their purpose, usage, and examples.
Data Structures
Explore the efficient and robust data structures available for managing your data.
Array
A dynamic array that automatically resizes as needed. Provides methods for adding, removing, and accessing elements.
No parameters.
A new, empty Array instance.
item
(T): The element to add to the end of the array.
index
(number): The zero-based index of the element to remove.
index
(number): The zero-based index of the element to retrieve.
let myArray = new Array<string>(); myArray.Add("Hello"); myArray.Add("World"); console.log(myArray.Get(0)); // Output: Hello
Dictionary
A collection of key-value pairs that allows for fast lookups, insertions, and deletions based on the key.
let userSettings = new Dictionary<string, boolean>(); userSettings.Add("darkMode", true); console.log(userSettings.Get("darkMode")); // Output: true
String Manipulation
Utilities for common string operations like formatting, parsing, and manipulation.
StringFormatter
Provides static methods for formatting strings, similar to `String.format` in other languages.
format
(string): The format string, using placeholders like `{0}`, `{1}`.
...args
(any[]): The arguments to insert into the placeholders.
let message = StringFormatter.Format("Welcome, {0}! You have {1} new messages.", "Alice", 5); console.log(message); // Output: Welcome, Alice! You have 5 new messages.
StringUtils
A collection of utility functions for string processing.
str
(string | null | undefined): The string to check.
str
(string): The string to trim.
let input = " Some text "; if (!StringUtils.IsNullOrEmpty(input)) { console.log(StringUtils.Trim(input)); // Output: Some text }
Math Operations
Essential mathematical functions and constants.
MathUtils
Provides enhanced mathematical utilities beyond the standard `Math` object.
value
(number): The value to clamp.
min
(number): The minimum allowed value.
max
(number): The maximum allowed value.
let clampedValue = MathUtils.Clamp(150, 0, 100); console.log(clampedValue); // Output: 100
System Services
Interactions with the underlying system and environment.
Environment
Provides information about the runtime environment.
name
(string): The name of the environment variable.
let apiKey = Environment.GetVariable("MY_API_KEY"); if (apiKey) { console.log("API Key found."); } else { console.log("API Key not set."); }