Posts

Showing posts from October, 2018

Skills for a Software Developer

1) OOPS 2) Any one scripting language 3) Any one programming language in depth 4) Software Architecture and design paterns 5) Deployment and release techniques 6) Code Management 7) Software process and documents 8) Seperation of Concerns Concepts 9) Single responsilbility Concepts 10) Art of Google Surfing

Find the number of occurrences of a specific character in a string using C#

using System; namespace saran { public class Program { public static void Main() { Console.WriteLine("Enter the string..."); string name =string.Empty; name =Console.ReadLine(); string c =string.Empty; Console.WriteLine("Enter the character..."); c =Console.ReadLine(); int cnt =(name.Length)-name.Replace(c,string.Empty).Length; Console.WriteLine(cnt); } } }

Find Whether the given string is palindrome or not using C#

If the given string and the reversed of the string is same then it is called "Palindrome".For instance Madam-madaM mom -mom Example using System; namespace saran { public class Program { public static void Main() { Console.WriteLine("Enter the string"); string name =string.Empty; string reversename =string.Empty; name = Console.ReadLine(); char[] n = name.ToCharArray(); Array.Reverse(n); reversename=new string(n); if(name.Equals(reversename,StringComparison.OrdinalIgnoreCase))    { Console.WriteLine(name+" is polindrome");    }    else    {   Console.WriteLine(name+" is not a polindrome");    } } } } output Enter the string mam mam is polindrome

Collections in C#

Collections are the type of classes which store series of information.There are 2 types of collections in c#.They are Generic collection Non-generic collection 1.Generic collection                                             Generic collections are depended in specific data types such as int,string and so on.Generic collections come under " System.Collections.Generic;   " library. i)List                          List requires only one type argument(in any data type).                        Example  using System; using System.Collections.Generic; namespace saran { public class Program { public static void Main() { List<int> age = new List<int>(); age.Add(25); age.Add(24); age.Add(23); foreach(int ...

Sealed Class in C#

Sealed class is used stop the inherit feature of the class. In other words non inheritable classes can be created using sealed keyword. Generally we can inherit the class and use the properties . In case if we don't want to inherit the class we have to add the keyword "Sealed".If the class has the keyword "Sealed" then it can't be inherited. Example:1 using System; namespace saran { public class Program { public static void Main() { Test t  =new Test(); Console.WriteLine(t.name); } } sealed class Test { public string name="ssn"; } } Output ssn Example:2 using System; namespace saran { public class Program { public static void Main() { Test t  =new Test(); Console.WriteLine(t.name); } } sealed class Test { public string name="ssn"; } public class derieve:Test { } } output Compilation error (line 19, col 15): 'saran.derieve': cannot derive...

Constructors in C#

                         Constructors are the special type of methods which are invoked automatically when the object of the class is created.Constructors are used to initialize the data members of the class.If no constructor is created then compiler will create default constructor .The default constructor initializes numeric fields 0 and string fields null . A Class can have any number of  constructors Constructors don't have any return type. Within a class only one static constructor can be created. Static constructor can't be a parametrized constructor. only one static constructor can be created in a class. There are 5 types of constructors in c# namely, Default constructor Parametrized construtor Copy Constructor Static Constructor Private Constructor 1.Default Constructor                                   ...

Finding the Primary and foreign keys of the table in Sql

Image
We have some ways to find the primary and foreign key information in Sql. Some of those are, 1.sp_help table name                           This will provide all the information about the specific table such as column names,constraints and so on. (e.g) sp_help eistmuser output 2.sp_pkeys  table name                                   This will return only the primary key details of the specific table. (e.g) sp_pkeys eistmuser output  3.sp_fkeys  table name                                                                                 This will return only the foreign key deta...

Good Thoughts and deeds.

Respect is earned by giving respect You will get what you  deserve,   not what you desire. Appreciating efforts of your parents. Preserving your hobbies. Throwing empty cans/ chips packets in dustbins instead of throwing them elsewhere. Exercising for 10 mins regularly. Having a positive mindset towards everything. Never expect anything from anyone as it always ends in disappointment. Never admit your parents to old age home. Living in the present

Access Modifiers in C#

                                 Access modifiers are the keywords which describe the accessibility of the class or its member.we can control the scope of the class and data types by this access modifiers. We can achieve Encapsulation using Access modifiers. There are 5 types of access modifiers in C# namely, Public Private Protected Internal Protected Internal 1.Public                Public is the most common access modifier.There is no restriction for public access modifier. It can be accessed from anywhere. It can be accessed by objects of the class. It can be accessed by derived classes. (e.g) using System; namespace saran { public class Program { public static void Main() { test t = new test(); t.name ="ssn";        Console.WriteLine(t.name); } } class test { public string name{get;set;} }...

Classes in C#

                Class is a collection of  related variables and methods . It represents the state and behavior of an object. A class definition can contain                 1.Fields                 2.Properties(accessors,mutators)                 3.Methods                 4.Constructor Properties are special public methods that allow a user of the class to " get " a variables value, or to a " set " a value (e.g) using System; public class Program { public static void Main() { EmployeeDetails employeeDetails = new EmployeeDetails(); employeeDetails.EmpAge=25; employeeDetails.EmpName="ssn"; employeeDetails.ShowDetails(); } } class EmployeeDetails { //Fields private string empName; private int empAge; //Properties public string EmpName ...

OOPS in c#

OOPS-Object Oriented Programming System.         It is the technique to develop software applications. Moreover  It is a programming structure that provides the ability to reuse the existing code. C# is pure Object Oriented Programming language.Important features of OOPS are Class Object Abstraction Encapsulation Inheritance Polymorphism 1.Class                 Class is a collection of  related methods and behaviors. In other words classes are the user defined data types that represent the state(properties) and behavior(actions) of the object. (e.g) Class Employee { ........ }  There are 4 types of classes,namely Abstract Class Partial Class Sealed Class Static Class 2.Object                                 Objects are the instances of the class. Through this only we can access the class details(Ex...

Types of Polymorphism in C#

In this article we are going to learn about  one of the feature of OOPS. Polymorphism      Acting differently under different conditions. There are 2 types Polymorphism. They are 1. Static (Compile Time) 2. Dynamic ( Run Time) 1. Static Polymorphism          Static Polymorphism is implemented by using  "Method overloading ". Creating multiple methods in a class with same name but different parameters and types is called " Method overloading ".Method overloading is the example of Compile time polymorphism . (e.g) using System; namespace Methodoverloading { public class First { public  int add (int a,int b) { return a+b; } public int add (int a) { return a+1; } public float add (float a) { return a; } } public class Program { public static void Main() { Console.WriteLine("Execution was started"); First fs = new First(); int a=fs.add(5,5); Cons...