What is Hashif Debug and How to Use It in C#

Nizamuddin Siddiqui
Updated on 05-Aug-2020 08:49:08

10K+ Views

In Visual Studio Debug mode and Release mode are different configurations for building your .Net project.Select the Debug mode for debugging step by step their .Net project and select the Release mode for the final build of Assembly file (.dll or .exe).The Debug mode does not optimize the binary it produces because the relationship between source code and generated instructions is more complex.This allows breakpoints to be set accurately and allows a programmer to step through the code one line at a time.The Debug configuration of your program is compiled with full symbolic debug information which help the debugger figure ... Read More

What is Bin and Obj Folder in C#

Nizamuddin Siddiqui
Updated on 05-Aug-2020 08:46:35

1K+ Views

Whenever we write a C# code and build or run the solution it generates 2 folders −binobjThese bins and obj has the compiled codeWhy do we have 2 folders?The reason is the compilation process goes through 2 stepscompilinglinkingIn the compiling every individual file is compiled into individual unitsThese compiled files will be later linked into one unit which can be a dll or an exeWhatever happens in the compiled phase will be added into obj folderThe final compilation that is the linked phase will go into bin folderThis obj folder is used in Conditional compilation or incremental compilationEx − I ... Read More

Difference Between IEnumerable and IQueryable in C#

Nizamuddin Siddiqui
Updated on 05-Aug-2020 08:43:49

10K+ Views

IEnumerable exists in System.Collections Namespace.IQueryable exists in System. Linq Namespace.Both IEnumerable and IQueryable are forward collection.IEnumerable doesn’t support lazy loadingIQueryable support lazy loadingQuerying data from a database, IEnumerable execute a select query on the server side, load data in-memory on a client-side and then filter data.Querying data from a database, IQueryable execute the select query on the server side with all filters.IEnumerable Extension methods take functional objects.IQueryable Extension methods take expression objects means expression tree.ExampleIEnumerabledbContext dc = new dbContext (); IEnumerable list = dc.SocialMedias.Where(p => p.Name.StartsWith("T")); list = list.Take(1); Sql statement generated for the above querySELECT [t0].[ID], [t0].[Name] FROM ... Read More

Binary Serialization and Deserialization in C#

Nizamuddin Siddiqui
Updated on 05-Aug-2020 08:35:45

3K+ Views

Converting an Object to a Binary format which is not in a human readable format is called Binary Serialization.Converting back the binary format to human readable format is called deserialization?To achieve binary serialization in C# we have to make use of library System.Runtime.Serialization.Formatters.Binary AssemblyCreate an object of BinaryFormatter class and make use of serialize method inside the classExampleSerialize an Object to Binary [Serializable] public class Demo {    public string ApplicationName { get; set; } = "Binary Serialize";    public int ApplicationId { get; set; } = 1001; } class Program {    static void Main()    {     ... Read More

Sum of First N Natural Numbers Divisible by 2 and 7 in C++

sudhir sharma
Updated on 05-Aug-2020 08:20:00

176 Views

In this problem, we are given a number N. Our task is to find the sum of first N natural numbers which are divisible by 2 and 7.So, here we will be given a number N, the program will find the sum of numbers between 1 to N that is divisible by 2 and 7.Let’s take an example to understand the problem, Input −N = 10Output −37Explanation −sum = 2 + 4 + 6 + 7 + 8 + 10 = 37So, the basic idea to solve the problem is to find all the numbers that are divisible by 2 ... Read More

Sum of Subset Differences in C++

sudhir sharma
Updated on 05-Aug-2020 08:18:41

282 Views

In this problem, we are given a set S of n number. Our task is to create a program to find the sum of subset difference which is the difference of last and first elements of subset.The formula is, sumSubsetDifference = Σ [last(s) - first(s)] s are subsets of the set S.Let’s take an example to understand the problem, Input −S = {1, 2, 9} n = 3Output −Explanation − All subset are −{1}, last(s) - first(s) = 0 {2}, last(s) - first(s) = 0 {9}, last(s) - first(s) = 0 {1, 2}, last(s) - first(s) = 1 {1, 9}, last(s) ... Read More

Sum of Similarities of String with All Suffixes in C++

sudhir sharma
Updated on 05-Aug-2020 08:17:23

252 Views

In this problem, we are given string str. Our task is to create a program to find the sum of similarities of the string with all of its suffixes.Suffixes of string str are all the strings that are created by eliminating starting characters of the string.Similarities of string str1 and str2 is the length of the longest prefix common to both the string. For example, str1 = ‘abbac’ and str2 = ‘abb’ is 3.While str1 = ‘abca’ and str2 = ‘ca’ is 0. As we count from start.Let’s take an example to understand the problem, Input − str = ‘xyxyx’Output ... Read More

Sum of Series 1^2 + 2^2 + 3^2 + ... + n^2 in C++

sudhir sharma
Updated on 05-Aug-2020 08:15:45

472 Views

In this problem, we are given a number n of the series. Our task is to find the sum of series 1^2 + 3^2 + 5^2 +... + (2*n - 1)^2 for the given value of n.Let’s take an example to understand the problem,Input −n = 5Output −84Explanation −sum = 1^2 + 3^2 + 5^2 + 7^2 + 9^2 = 1 + 9 + 25 + 49 = 84A basic approach to solve this problem is by directly applying the formula for the sum of series.Example Live Demo#include using namespace std; int calcSumOfSeries(int n) {    int sum = 0;    for (int i = 1; i

Sum of Special Triplets Having Elements from 3 Arrays in C++

sudhir sharma
Updated on 05-Aug-2020 08:13:15

206 Views

In this problem, we are given 3 array X, Y, Z. Our task is to create a program to find the Sum of special triplets having elements from 3 arrays.Special Triplet is a special type of triplet that hold the following property −For (a, b, c): a ≤ b and b ≥ c, i.e the middle element of the triplet should be greeter that the other two.And, the value of the triplet is given by the formula −f(a, b, c) = (a+b) * (b+c)To create this triplet we need to use one element from each other the three arrays given.Let’s ... Read More

Sum of Smaller Elements of Nodes in a Linked List in C++

sudhir sharma
Updated on 05-Aug-2020 08:09:34

144 Views

In this problem, we are given a linked list with a node consisting of two values and a pointer. Our task is to create a program to find the sum of smaller elements of a node in a linked list.Here, in the linked list we have two elements say X and Y. The program will find a minimum of x and y. The minimum elements from all nodes are added which is the required result.Input −(5, 2)->(7, 9)->(6, 3)->(36, 24)->(19, 26)->nullOutput −55Explanation −Let’s take the minimum of X and Y from each node −node1 - mini = 5 node2 - ... Read More

Advertisements