Professional Documents
Culture Documents
VTU DotNet Module 4 by Keval M Jain
VTU DotNet Module 4 by Keval M Jain
Properties:
• Set Accessor: It will specify the assignment of a value to a private field in a
property. It returns a single value and it specifies the write-only property.
Example:
class Geeks {
• Read-Write Property:
• Auto Implemented Properties: (optional)
o/p
INDEXERS IN C#:
Syntax 2:
Difference between Array and Array list:
GENERICS IN C#
o/p;
COLLECTIONS IN C#:
Collections are similar to Arrays, it provides a more flexible way of working with
a group of objects.
In arrays, you would have noticed that you need to define the number of
elements in an array beforehand. This had to be done when the array was
declared.
But in a collection, you don't need to define the size of the collection
beforehand. You can add elements or even remove elements from the collection
at any point of time. This chapter will focus on how we can work with the
different collections available in C#.
o/p:
Constructors:
o/p:
NOTE: In collection initializer hash set program we don’t use add method, we
declare at the time of hash set initialization.
Methods:
o/p:
Ex:
o/p:
Methods:
Ex:
o/p:
INSERT NODE/KEY IN A BINARY TREE:
Program ex:
struct node* insert(struct node* root, int key)
{
// Base Cases: root is null or key is present at root
if (root == NULL || root->key == key)
return root;
------------------------END-------------------------------