How to convert original text to hash text using md5 and sh1 Algorithms in asp.net c#

By // 1 comment:
Introduction:- Hashing is secure and helpful concepts to convert original text to hash text.It is a cryptography Technology.There are many cryptography technology such symmetric and asymmetric but here we will learn only hashing concepts (md5 and sh1).If you want to discuss more details about cryptography ,you can contact me(holiday only).
  • A Hash function is an Algorithm which creates a digital representation or 'fingerprint' in the form of a "hash value" of a standard length.
  • Hash value is usually much smaller than the message.
  • It is one way function.
3

Readonly and Constant members in C# with Example

By // No comments:
1.) Read-only Field:-
The readonly keyword is  a modifier that you can use fields.When a field declaration includes a readonly modifier,assignments to the fields introduced by the declaration can only occur as part of the declaration or in a construction in the same class.You can learn constructor concepts more details.
You can assign a value to a readonly field only in the following way.
  • Variable can be initialized at declaration time.
           Ex. Public readonly int p=8;
  • For an instance field ,in the instance constructors of the class that contains the field declaration.
                                                                              OR
  • For a static field ,in the static constructor of the class that contains the field declaration .
  • You can also pass a readonly field as an out or ref parameter.
3

How to use Checked and Unchecked Operators in C#

By // 1 comment:
There are two operators used in c# to handle the overflow exception control as given below.
  1. Checked Operator
  2. Unchecked Operator
1.) Checked Operator :-
C# provides the checked and Unchecked operators.If we use checked operator in codes, the CLR will enforce overflow checking and throw an exception if an overflow occurs.  Example:-


private void button1_Click(object sender, EventArgs e)
        {
            byte m = 255;
            checked
            {
                m++;
            }
            MessageBox.Show(m.ToString());
        }

Output :-OverflowException was Unhandled
If we run this codes then we will get an error message. I will show it later.
Note :-
The Byte data type can only hold values in the range 0 to 255 ,so incrementing the value of m causes an overflow.
1.) UnChecked Operator :-
If we want to suppress overflow checking, we can use Unchecked operator.In this case, no exception will be raised,but we will lose our data.We already know that ,the byte type can't hold a value of greater than 255.So the overflow bits will be discarded.Variable m hold a value of zero.
Example:-

private void button2_Click(object sender, EventArgs e)
        {
            byte m = 255;
            unchecked
            {
                m++;
            }
            MessageBox.Show("m=" +m.ToString());
        }

Output :- m=0
3

How to implement Polymorphism Concepts in C#

By // No comments:
Polymorphism is a ability to take more than one form. An operation may exhibit different behaviour in different situations.There are two type of polymorphism in oops as given below:-
  1. Operation Polymorphism
  2. Inclusion Polymorphism 
type

3

How to Run C# program on Notepad using Visual studio Command Prompt

By // 4 comments:
Hi Friends! today i am going to explain "How to Run C# program on Notepad  "We Generally Run C# programs using Visual studio IDE. It is easy process to Run the c# program. A Good programmer runs his programs on Notepad because he does not take any help through IDE (e.g.Visual studio).He can run the program without using any tools.If you want to Run the program on Notepad then you have to good knowledge in programming (e.g. Syntax , Datatype ,input and output steams etc.).Now i am going to print  Rectangle star(*) using c#.
There are some steps to implement (Run) this concepts on Notepad Which are given below:-
Step 1:- First open Your Notepad -->Write a program to print a rectangle using c# as shown below:-
3

Threading in c#

By // No comments:
C# supports the concept of Multithreading which helps to execute two or more  "parts" of a program currently.Every part is known as a thread.A thread is a separate sequence of instructions for  executing a specific task in the program. Multithreading means,performing multiple tasks at the same time during the execution of a program.Every c# program starts the execution with a single thread which is called main thread .The Main thread is runned by the (CLR) & operating system.
          The process of developing a program for execution with multiple threads , is called multithreading programming and the process of  execution is called multithreading.
There are some advantage of threading in c#.
  • Optimize the use of computer resources such as memory i/o device.
  • Minimize the time
3

Operator overloading in C#

By // 1 comment:
Operator overloading is one of the good feature of Object Oriented Programming.C# supports the operator overloading concepts.Operators in C# can be defined to work with the user-defined data types such as structs and classes .It Works the same way as the Built in  types.
There are some operators in C# that can be overloaded.
  1. Overloadable operators
  2. Non Overloadable operators

     1. ) Overloadable operators:-

3

Reflection in C#

By // 2 comments:
Reflection is a concept through which we can load an assembly(.exe )File at run time and can get it  Meta Data. Reflection is used to view attribute information at run time.Reflection allows late binding to method and properties.
To implement this concept required classes that reside within "System.Reflection" Namespace.
There are two method to Get Meta Data from assembly(.exe)file in .Net.
  1. Using Visual Studio Command Prompt.
  2. Custom Meta Data viewer(Using Programming).
3

Directory and DirectoryInfo Classes in C#

By // 1 comment:
Directory and DirectoryInfo  Classes can be used to get some information or for doing some manipulation regarding Directory.This classes are basically  used for Directory Manipulation.
  • Directory Class Provide Static Method.
  • DirectoryInfo class provide Non Static Method.
Example of Directory Class:- There are some steps to understand the Directory Class in C# Which is given below:
Step :1 First open Your Visual studio--> File-->New-->Project->Windows Forms Application-->OK.--> Drag and Drop controls on form  like given below:
3

File and FileInfo Classes in C#

By // No comments:
These Classes can be used to do some manipulation and to set some information regarding the File.
File Class:- File class provided Static Method.It means that there is no need to create the object of the class for access the class Methods.we already know that static member  can access through  the class directly.
FileInfo Class:- FileInfo Class provided the Non Static Method.It means that we will need to create the object of the class  for access  class methods. Class is loaded in memory when the object of the class will be created.
Example of File class:-
There are some steps which is give below.
3

File Handling in C#

By // No comments:
All the classes related to File Handing Resides in "System.IO" Namespace. Data can be retrieved from Database  and FileDatabase is basically used for handling Data in an Efficient and Secure manner but In case of File  we can not handle data  more efficient like database.  More problem with File is ,we can not handle data operations  securely .The System.IO  Namespace contains Enumerations and classes that  can be used for read and Write Data into the File.File Handling is  a very most important topic ,in this Topic i will give you  more Real Time application ,which will help you understanding the File  Handling concept in C#.First i am going to explain basics of File Handing with one Real application.Which is given below:
File mode Enumeration:
There are some modes of File which is mostly used in Real application.
3

Generic Collection in C#

By // No comments:
Generic Collection is the concept  which is introduce in 2.0 in C#.By using this concept we can create such class,method,interface,delegate and structure which take Type as Parameter.With the help of this  Generic collection we can easily  work any Data type without any type conversion. In Generic collection there is no need of Boxing and Unboxing of the values . Values will store in a specific type.
Example: List,Dictionary,Stack,Queue etc.
There are two main Example of Generic collection which are given below:

1.Generic Method :

In Generic method  we use angular bracket(<p>) for Parameter Type .You can easily pass any Data Type at Run time to the Function(Method) in the program.
3

Collection in C#

By // No comments:
Collection classes  are basically  used for data retrieval and data storage purpose.It is also used for Dynamic memory allocation and indexing purpose.Through Indexing property we can retrieve data very fast.Collection is the improvement of array in which we can store any types of data and improving the functionality of the array like:
  • Fixed size of array.
  • Insertion problem in array.
  • Similar type of Data type .
3

Exception Handling in C#

By // 1 comment:
While writing and running the program there might be three types of error.
  1. Compile Time Error:-This error generally occurs because of syntax error.
  2. Run Time Error(Exception):- This error occurs when application is running but some logic is failed according to CLR.
  3. Logical Error:-Program is compile and running successfully but we are not getting the expected output due to not written correct logic.
Exception Handling:-In Exception handling we provide an alternate path that if some error occurs at run time instead of halting the program.some alternate path of code executed.There are some keywords which is used in exception handling.
3

String and StringBuilder in C#

By // 1 comment:
These two type of class use for character type of values but 'String' is Immutable and resides within System Namespace .  StringBuilder is mutable and it resides "System.Text" Namespace.
  • Mutable -->means -->change in value
  • Immutable -->means -->No change in value
I have full explained what is mutable and immutable with the help of  example which is given below:
3

Event In C#

By // 2 comments:
Event is a kind of Notification(Information) giving one by one object to perform task. Event handling is not possible without delegate because it is delegate who will be responsible to call Event handler which even is fired.
Event Declaration:-
<access specifier-->Event Keyword-->Delegate Name--> Event Name>;
Ex:-
3

Delegate In C#

By // 1 comment:
Delegate is an object type which can be used to Encapsulate the method call and handle the event.Through Delegate only that function can be called whose signature and  Return Type is same as DelegateDelegate basically helps for calling the other class method. Delegate can be declared within the class or outside the class.Delegate is like a method but it is use like a class to create the object of del class.
There are some feature of delegate in C#.
3

Namespace in .NET

By // No comments:
Hi friends ! many times i have seen that student do not include Namespace in our program , so that program gives error.Then student are faced more problems to Run the program. Before including Namespace ,you should know what is Namespace and why include it in our program.If you want to make a good programmer in c# then you should know more well about Namespace.Please read every things about Namespace which is give below:
What is Namespace in C#?.
A Namespace is collection of classes with related type contained in a assembly file.
Ex.
 System.IO Namespace is used for I/O related type Files and Buffering.
3

Params Keyword in C#

By // No comments:
It is very good feature of  c# language.we can use params keyword only array type parameter.when we are using params keyword in any method then we can directly pass the parameter  to the method.
If we do not use params keyword in array type parameter then there are some extra work which are given below:
  • Declare of array first
  • Initialization of array value
  • after that parameter pass to the method
3

Out parameter in C#

By // 2 comments:
We already know that if we specify the return type of any method then we can get only one value at a time.But if we want method return more than one value at a time then we must use out parameter in the function. We need to use out keyword while declaring the parameter as well as while calling the method.
I have explained this concept with the help of suitable program which is give below.Please follow following steps.
3
Powered by Blogger.