C# and Angular.

The week started with sharing thoughts about object oriented programming structure. Everyone started adding their views on object oriented programming. When I feel that I also had some thoughts about object oriented programming structure, I shared things like Facebook how they're integrating all there applications like facebook.com instagram.com and whatsapp.com and then combining all together to form a big tech giant Meta.

After that we just shared knowledge about cloud to cloud oh works and how cloud provider makes money and how the backup of data will be works.

After that Arun sir shared their knowledge about cloud mainly on infrastructure wait cloud helps what is the needs of clouds what is the main advantage of using cloud all those things are shared by Arun sir.

Date: 21–02–2022

Assignment No. 27: DLithe_BC_NFS_T_Task27_C#

The given task is to implement C# programs as per below requirements

1. Strings
2. Nullable
3. Partial Class and Partial Method

C# Strings

Strings are used for storing text.

A string variable contains a collection of characters surrounded by double quotes

Example:

// Strings

// Strings

string var1 = “Hello!, I’m Charan”;

Console.WriteLine(var1);

Nullable

A nullable value type T? represents all values of its underlying value type T and an additional null value. For example, you can assign any of the following three values to a bool? variable: true, false, or null. An underlying value type T cannot be a nullable value type itself.

Any nullable value type is an instance of the generic System.Nullable<T> structure. You can refer to a nullable value type with an underlying type T in any of the following interchangeable forms: Nullable<T> or T?.

You typically use a nullable value type when you need to represent the undefined value of an underlying value type. For example, a Boolean, or bool, variable can only be either true or false. However, in some applications a variable value can be undefined or missing. For example, a database field may contain true or false, or it may contain no value at all, that is, NULL. You can use the bool? type in that scenario.

Example:

The above program output:

Nullables at Show: , 45,  , 3.14157
A Nullable boolean value:

3. Partial Class and Partial Method

A partial class is a special feature of C#. It provides a special ability to implement the functionality of a single class into multiple files and all these files are combined into a single class file when the application is compiled. A partial class is created by using a partial keyword. This keyword is also useful to split the functionality of methods, interfaces, or structure into multiple files.

Syntax :

public partial Clas_name  
{
// code
}

Example:

File 1:

File 2:

Date: 25–02–2022

Assignment No. 32:DLithe_BC_NFS_T_Task32_C#

The given task is to implement the C# programs as per the requirements

1. Virtual Functions
2. Generics
3. Files

Virtual Functions

What are virtual functions in C#?

The virtual keyword is useful in modifying a method, property, indexer, or event. When you have a function defined in a class that you want to be implemented in an inherited class(es), you use virtual functions. The virtual functions could be implemented differently in different inherited class and the call to these functions will be decided at runtime.

The following is a virtual function

public virtual int area() { }

Simple Exmple:

Sample output:

2. Generics

Generic means the general form, not specific. In C#, generic means not specific to a particular data type.

C# allows you to define generic classes, interfaces, abstract classes, fields, methods, static methods, properties, events, delegates, and operators using the type parameter and without the specific data type. A type parameter is a placeholder for a particular type specified when creating an instance of the generic type.

A generic type is declared by specifying a type parameter in an angle brackets after a type name, e.g. TypeName<T> where T is a type parameter.

Generic Class

Generic classes are defined using a type parameter in an angle brackets after the class name. The following defines a generic class.

Simple Example:

Sample Output:

3. Files

A file is a collection of data stored in a disk with a specific name and a directory path. When a file is opened for reading or writing, it becomes a stream.

The stream is basically the sequence of bytes passing through the communication path. There are two main streams: the input stream and the output stream. The input stream is used for reading data from file (read operation) and the output stream is used for writing into the file (write operation).

C# I/O Classes

The System.IO namespace has various classes that are used for performing numerous operations with files, such as creating and deleting files, reading from or writing to a file, closing a file etc.

The following table shows some commonly used non-abstract classes in the System.IO namespace.

The FileStream Class

The FileStream class in the System.IO namespace helps in reading from, writing to and closing files. This class derives from the abstract class Stream.

You need to create a FileStream object to create a new file or open an existing file. The syntax for creating a FileStream object is as follows −

FileStream <object_name> = new FileStream( <file_name>, <FileMode Enumerator>,
<FileAccess Enumerator>, <FileShare Enumerator>);

For example, we create a FileStream object F for reading a file named sample.txt as shown

FileStream F = new FileStream("sample.txt", FileMode.Open, FileAccess.Read,
FileShare.Read);

Simple Example:

The sample output:

=============================================

Date: 25–02–2022

SQL Commands

  • SQL commands are instructions. It is used to communicate with the database. It is also used to perform specific tasks, functions, and queries of data.
  • SQL can perform various tasks like create a table, add data to tables, drop the table, modify the table, set permission for users.

Assignment No. 33: DLithe_BC_NFS_T_Task33_SQLSERVER

The given task is to implement SQL Queries as per the requirements

1.DDL
2.DML
3.CONSTRAINTS
4.HOW TO GIVE USER-DEFINED CONSTRAINT NAMES
5.MULTIPLE ROWS IN ONE INSERT QUERY

DDL -Data Definition Language

  • DDL changes the structure of the table like creating a table, deleting a table, altering a table, etc.
  • All the command of DDL are auto-committed that means it permanently save all the changes in the database.

Here are some commands that come under DDL:

  • CREATE
  • ALTER
  • DROP
  • TRUNCATE

DML-Data Manipulation Language

  • DML commands are used to modify the database. It is responsible for all form of changes in the database.
  • The command of DML is not auto-committed that means it can’t permanently save all the changes in the database. They can be rollback.

Here are some commands that come under DML:

  • INSERT
  • UPDATE
  • DELETE

Sample SQL File 2:

3. CONSTRAINTS and HOW TO GIVE USER-DEFINED CONSTRAINT NAMES

For creating our own constraints with the given names we have to use constant keyboard below you are seeing this simple example of constraints with the screenshot of the output image.

The sample screenshot:

5.MULTIPLE ROWS IN ONE INSERT QUERY

We know that inserting values to table is very boring task we have to insert where is row by row instead of that we can insert all the values or all the tables in one command that is followed in the below code and I also attached a screenshot of the output.

The sample screenshot of the above code

--

--

Charan H U

Applied AI Engineer | Internet Content Creator | Freelancer | Farmer | Student