Skip to main content

Posts

Difference Between ref and out Keywords

=> ref causes an argument to be passed by reference not by value.  It provides a reference to the source value and changes made in the method will be made to the source object =>  Arguments passed as ref must be initialized before they are passed. =>  out also causes an argument to be passed by reference.  Changes made to the parameter are also changed in the source. =>  Arguments passed using out do not have to be initialized first. =>  The called method must assign a value prior to the method return statement

When to Use a struct vs Class, Cont’d

=> structs are value types that can contain data and functions. =>  structs are value types and do not require heap allocation. =>  structs directly store their data in the struct , classes store a reference to a dynamically allocated bject. =>  structs are useful for small data structures.  =>  structs can affect performance =>  Constructors are invoked with the new operator, but that does not allocate memory on the heap  =>  A struct constructor simply returns the struct value itself (typically in a temporary location on the stack), and this value is then copied as necessary  =>  With classes, multiple variables may have a reference to the same object  =>  It is possible for operations on one variable to affect the object referenced by the other variable. =>  With structs , the variables each have their own copy of the data, and it is not possible for operations on...

What is the Difference between String and string

=>The string type is a sealed class type that inherits directly from object. Instances of the string class represent Unicode character strings. =>  Values of the string type can be written as string literals. =>  The keyword string is simply an alias for the predefined class System.String so you can use string name = “Fred”; or String name = “Fred”;. =>  Likewise you can use string.Concat () or String.Concat () =>  Use string for variable names =>  Use S tring for class methods and reference

Identify and Delete duplicate Records in SQL Server

      S cenario: I have accumulated data into SQL Server database from three different servers (oracle, O2 and oracle) for a financial reporting. After data accumulated , we found more duplicate rows; business requirement was to remove all duplicate rows because of final data will be import to another system. For this purpose, I want to write script to find out duplicate rows from my table. Finally, I want to delete only duplicate rows not original row. Original row means if i have total 2 rows those same or duplicate, so I want to delete only one row that is duplicate. Let’s go............................ Step 1: Create a student Table below Script: CREATE TABLE [Students] (     [ID] [int] NULL,     [Name] [varchar] ( 50 ) NULL,     [address] [varchar] ( 50 ) NULL,     [contact] [varchar] ( 50 ) NULL,     [email] [varchar] ( 50 ) NULL ...

Difference between Thread and Process

A Process is an instance of a running application. And a thread is the Execution stream of the Process. A process can have multiple Thread. When a process starts a specific memory area is allocated to it. When there are multiple threads in a process, each thread gets a memory for storing the variables in it, and plus they can access the global variables which are common for all the threads. Thread: is used to execute more than one program at a time. The process can execute a single program. Thread is a path of execution that runs on the CPU, a process is collection of threads that share the same virtual memory. A process has at least one thread of execution, and a thread always runs in a process context.