0% found this document useful (0 votes)
41 views4 pages

cp2 To

An array is a collection of elements of the same type stored in contiguous memory locations that can be individually accessed via an index. Arrays allow storing multiple elements of the same type together and accessing them via their index. Some key points about arrays in C# include that they have a fixed size set at creation time, elements are accessed using indexes with square brackets, multi-dimensional arrays are supported, and common methods exist like CopyTo to copy elements between arrays.

Uploaded by

Nhyel De Jesus
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views4 pages

cp2 To

An array is a collection of elements of the same type stored in contiguous memory locations that can be individually accessed via an index. Arrays allow storing multiple elements of the same type together and accessing them via their index. Some key points about arrays in C# include that they have a fixed size set at creation time, elements are accessed using indexes with square brackets, multi-dimensional arrays are supported, and common methods exist like CopyTo to copy elements between arrays.

Uploaded by

Nhyel De Jesus
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

The highest address of an array is called last element

Clear - It sets range of elements in the array to zero to false or null, dependings on the element type
The simplest form Of the multidimensional array is TWO DIMENTIONAL ARRAY
Copy – copies a range of elements from an array starting at the first element and pastes them into
another array starting at the first element .the length is specified as 32 bit integer.
[ ] specifies the rank of the array. rank specifies the size of the array.
An array stores a fixed-size sequential collection of elements of the same type.
Element – is accessed by indexing the array name. This is done by placing the index of the element
within square brackets after the name of the array.
Subscript – an element in 2-dimenstional array is accessed by using _subscript___
Array class- It is the base class for all the array in C#. It is define in the System namespace.
Multi-dimensional arrays - are also called rectangular array. You can declare a 2-dimensional array of
strings
Array Name- specifies the name of the array.
Jagged arrays - are arrays of arrays.
CopyTo(Array, Int32) Copies all the elements of the current one-dimensional Array to the specified one-
dimensional Array.
First element - the lowest address of an array

An array is used to store a collection of data


An array as a collection of variables of the same type stored at contiguous memory locations.
A specific element in an array is accessed by an index.
All arrays consist of contiguous memory locations
Declaring Array - To declare an array in C#, you can use the following syntax − datatype[] arrayName;
Datatype is used to specify the type of elements in the array
Initializing an Array - Declaring an array does not initialize the array in the memory
When the array variable is initialized, you can assign values to the array.
Array is a reference type, so you need to use the new keyword to create an instance of the array.
Assigning Values to an Array - You can assign values to individual array elements, by using the index
number, like –
You can assign values to the array at the time of declaration
You can also create and initialize an array
You may also omit the size of the array, as shown
You can copy an array variable into another target array variable. In such case, both the target and
source point to the same memory location
Foreach Loop - foreach statement to iterate through an array.
Param arrays - This is used for passing unknown number of parameters to a function.
IsFixedSize Gets a value indicating whether the Array has a fixed size.
IsReadOnly Gets a value indicating whether the Array is read-only.
Length - Gets a 32-bit integer that represents the total number of elements in all the dimensions of the
Array
LongLength - Gets a 64-bit integer that represents the total number of elements in all the dimensions of
the Array.
Rank Gets the rank (number of dimensions) of the Array.
GetType - Gets the Type of the current instance. (Inherited from Object.)
GetValue(Int32) - Gets the value at the specified position in the one-dimensional Array. The index is
specified as a 32-bit integer.
Index Of Array, Object) Searches for the specified object and returns the index of the first occurrence
within the entire one-dimensional Array.
Reverse(Array) - Reverses the sequence of the elements in the entire one-dimensional Array.
Sort(Array) - Sorts the elements in an entire one-dimensional Array using the IComparable
implementation of each element of the Array
ToString - Returns a string that represents the current object. (Inherited from Object.

Data encapsulation – is the hiding implementation details of the user through an objects method
Object oriented interface – unites with the real world manipulating software objects for designing
purposes
Package - It is collection of classes
DRY( don’t repeat yourself ) - It is principle about reducing the repetition of code
Inheritance – the process of acquiring properties
Class - Is a group of objects that has mutual methods
Object oriented programming – it is about creating objects that contain both data and method
Objects – it contains two characteristics, namely state and behavior.
Public interface – the point where the software entities interact with each other in a single computer or
in a network
Polymorphism – it the process of using same method name by multiple classes and redefines methods
for the derived classes.
Object-oriented programming (OOP) is a programming paradigm based on the concept of objects, which
are data structures that contain data, in the form of fields (or attributes) and code, in the form of
procedures, (or methods).
Procedural programming is about writing procedures or methods that perform operations on the data,
while object-oriented programming is about creating objects that contain both data and methods.
OOP is faster and easier to execute
OOP provides a clear structure for the programs
OOP helps to keep the C# code DRY "Don't Repeat Yourself", and makes the
code easier to maintain, modify and debug
OOP makes it possible to create full reusable applications with less code
and shorter development time
A method is a block of code which only runs when it is called.
Methods are used to perform certain actions, and they are also known as functions.
method overloading, multiple methods can have the same name with different parameters:
Parameters act as variables inside the method.
When a parameter is passed to the method, it is called an argument
A constructor is a special method that is used to initialize objects.
The garbage collector (GC) manages the allocation and release of memory.

Abstract class – it includes abstract and non-abstract methods. A class is declared abstract to be an
object
Use a sealed keyword if you don’t want other classes to inherit from a class
Interfaces - Is defined as a syntactical contract that all classes inheriting the interface should follow
Static class – it is sealed and cannot contain instance contractor
Derived Class – The class that inherit from another class
Base class – the class being inherit from
Anonymous methods – it provides a technique to pass a code block as a delegate parameter
Delegates – are used to reference any methods that has the same signature as that of the delegate
Overriding – a method that is implemented by abstract classes and virtual functions. Abstract classes
contain abstract methods ,which are implemented by the derived class.
Runtime polymorphism – has method overriding that is also known as dynamic binding or late binding
Abstract classes contain abstract methods, which are implemented by the derived class.

You might also like