Category: OOP

code for reverse string in c# and find duplicate record in jquery

static string reverse(string ss) { string[] strArray = ss.Split(‘ ‘) ; string revs=””; //int i = strArray.Length; StringBuilder sb = new StringBuilder(); for (int i = 0; i < strArray.Length; i++)   { string ty = string.Join(“”,strArray[i].Reverse().ToArray()); //            string firstLetter = strArray[i].Substring(0, 1); string firstLetter = ty.Substring(0, 1); //string secondPart = strArray[i].Substring(strArray[i].Length -2 ,0); string secondPart = ty.Substring(1);   sb.Append(firstLetter.ToUpper()… Read more →

IEnumerable VS IQueryable

IEnumerable IEnumerable exists in System.Collections Namespace. IEnumerable can move forward only over a collection, it can’t move backward and between the items. IEnumerable is best to query data from in-memory collections like List, Array etc. While query data from database, IEnumerable execute select query on server side, load data in-memory on client side and then filter data. IEnumerable is suitable… Read more →

Partial class,partial method and Anonymous Type

Partial class– It is possible to split the definition of a class or a struct, an interface or a method over two or more source files. Each source file contains a section of the type or method definition, and all parts are combined when the application is compiled. There are several situations when splitting a class definition is desirable: When… Read more →

Sealed,static and abstract class difference.

Sealed Class A sealed class cannot be used as a base class. Sealed classes are primarily used to prevent derivation. Because they can never be used as a base class, some run-time optimizations can make calling sealed class members slightly faster.   We can also use the sealed modifier on a method or property that overrides a virtual method or… Read more →

Overriding

Overriding is the process of changing the implementation of a virtual (or possibly abstract) method defined within a base class. Read more →

Enum and Enumerable data

An enum is a custom data type of Name/Value pair.An enumeration is a class or structure that implements .net interface named Ienumerable. Typically, this interface is implemented on collection classes, as well as the System.Array class // Compile-time error! 999 is too big for a byte! enum EmpType : byte { Manager = 10, Grunt = 1, Contractor = 100,… Read more →

Difference between linq and lambda expression

LINQ is a querying technology (Language Integrated Query). LINQ makes extensive use of lambda’s as arguments to standard query operator methods such as the Where clause. A lambda expression is an anonymous function that contain expressions and statements. It is completely separate and distinct from LINQ. Read more →

Distinction between output and reference parameter

>>output parameter do not need to initialize before the passed to the method.it must assign when before  exiting the method calling. >>reference parameter must assign the before passed to the method. The reason is that passing the reference to an existing variable. If not assign works as unassigned variable. // Returning multiple output parameters. static void FillTheseValues(out int a, out string… Read more →