Posts

Resolved Issue in Asp core 3.0 serializersettings does not exist in AddJsonOptions

Hello, When we want to use serializersettings  function in configure service (IN startup .cs) for CamelCasing .then we get this issue  in asp core 3.0. So we can resolve it by adding below code in configure service file public void ConfigureServices(IServiceCollection services) { services.AddMvc(setupAction => { setupAction.EnableEndpointRouting = false; }).AddJsonOptions(jsonOptions => { jsonOptions.JsonSerializerOptions.PropertyNamingPolicy = null; }) .SetCompatibilityVersion(CompatibilityVersion.Version_3_0);

.NET Core 3.0: Razor views don't automatically recompile on change

In this article i will provide the solution how to recompile asp core 3.0 application and show the changes on browser when we change something in Razor (views)  while debug mode . Applications that require runtime compilation or re-compilation of Razor files should: Add a reference to the Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation package. It'll be available as part of the 3.0.0-preview3 release. Update the application's ConfigureServices to include a call to AddMvcRazorRuntimeCompilation: public class Startup { public Startup(IConfiguration configuration) { Configuration = configuration; } public IConfiguration Configuration { get; } // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc().AddRazorRuntimeCompilation(); } }

.Net most asked interview questions for experienced professionals (C#,Asp WEBFORM,MVC,ASP CORE,WEB API,SQL Server,Java Script,Jquery)

Hello All Recently I have participated in multiple interviews. I found a lot of most frequently asked questions on the .Net framework. So I am just going to share with you, I hope it will be helpful while interview. I am just starting from C# questions and you have to find the answer over the Internet. I will update more question later C# Question    What is manage/Unmanaged code in c#  Tell me one scenario, Use of Interface instead of Abstract? Difference between Abstract Class and Interface with Scenario when to use it (Brief explain ) What happens if the inherited interfaces have conflicting method names? If one interface has 5 methods and wants to implement only 2 methods derived class. How can we do it? What Difference between Abstract and virtual method  and why we use if both near to  same  What is Constructor and its type, Default, Public, Private, Static  What is the Constructor Chaining in C#? What is  Property with give me an example, tell me

how to make a program which checks and count occurrences Value in An Array in c#

Image
In this article, I will show, how to make a program which checks and count occurrences value in an Array  in c# using System; using System.Collections; using System.Collections.Generic; using System.Linq.Expressions; namespace testconsole {     class Program     {               static void Main(string[] args)         {             int[] myArray = new int[] { 1, 2, 3, 4, 5, 6, 2, 2 };             string chekvalue = "";             for  (int i = 0; i < myArray.Length-1; i++)             {             if (chekvalue.Contains(myArray[i].ToString()))                 {                 }                 else {                     chekvalue = myArray.Length-1 + chekvalue;                     Console.Write(myArray[i] + " : ");                     int count = 0;                 for (int j = 0; j < myArray.Length - 1; j++)                 {                     if (myArray[i] == myArray[j])                     {                      

how to make a program which checks and count occurrences characters in a string in c#

Image
In this article, I will show, how to make a program which checks and count occurrences characters in a string in c# using System; using System.Collections; using System.Collections.Generic; using System.Linq.Expressions; namespace testconsole {     class Program     {               static void Main(string[] args)         {             string input = "this is Manvendrs Patel Blog ";             string chekvalue = "";             for  (int i = 0; i < input.Length; i++)             {             if (chekvalue.Contains(input[i].ToString()))                 {                 }                 else {                     chekvalue = input[i] + chekvalue;                     Console.Write(input[i] + " : ");                     int count = 0;                 for (int j = 0; j < input.Length; j++)                 {                     if (input[i] == input[j])                     {                         count++;      

How to Remove Duplicate characters from String in C#

Image
Hello All, In this Program, I will show you, how to make a program to remove duplicate characters from strings using c# using System; using System.Collections.Generic; namespace testconsole { class Program { static void Main(string[] args) { string Stringvalue = "this is Apple"; string result = ""; Console.WriteLine("Before remove duplicate character :{0} ", Stringvalue); foreach (char ch in Stringvalue) { if(result.Contains(ch.ToString())) { } else { result = result + ch; } } Console.WriteLine("after remove duplicate character :{0} ", result); Console.ReadKey(); } } }

How to Check any value in Array element is duplicate or not in C#

Image
In this article, I will show you how to make a simple program to check any value is duplicate or not in Array. It will return true if the value exists duplicate in Array else false. using System; using System.Collections.Generic; namespace testconsole { class Program { static void Main(string[] args) { Console.WriteLine(checkduplicate(1,2,3,2,2)); Console.ReadLine(); } public static bool checkduplicate(params int[] A) { Dictionary<int, int> d = new Dictionary<int, int>(); foreach (int i in A) { if (d.ContainsKey(i)) return true; else d.Add(i, 1); } return false; } } }