There is no difference between string and String as they are just alias. We can use any of them for each other.
Category: Uncategorised
Difference in Controller and ControllerBase Class in
Controler.cs
A base class for an MVC controller with view support.
ControllerBase.cs
A base class for an MVC controller without view support.It is used on Web api in ASP .Net Core.
Following components don’t exist in ASP.NET Core:
1.ApiController class
2.System.Web.Http namespace
3.IHttpActionResult interface
Cross Join Vs Inner Join in SQL Server
- SQL INNER JOIN: It returns the records (or rows) present in both tables, If there is at least one match between columns.
- SQL CROSS JOIN: It returns the Cartesian product of both the tables. Cartesian product means Number of Rows present in Table 1 Multiplied by Number of Rows present in Table 2.
What is the difference between String.Empty and “” in c#
String x= “”;
String x= String.Empty;
String.Empty will assign reference of memory each time. When you provide value to variable memory is allocated to that variable.
In other case each time memory will be allocated.
What is difference between = and == and === in jquery ?
= This is an assignment operator.
== This is an comparison operator. e.g.
"2"==2;// output: true
=== This operator compares value of both side with type checking.
e.g.
"2"==2;//output:false
What is Rest
Rest(Representational State Transfer) is a architectural pattern to develop a api in restful manner
1- Follow rest suggested uri pattern e.g http://ABC.com/api/manage-employee http://ABC.com/api/manage-employee/1
2- Follow respective HttpVerb for each action.
e.g.
[HttpGet] //for retrieve data http://ABC.com/api/manage-employee
[HttpPut] // for update http://ABC.com/api/manage-employee/1
3. It works over HTTP Protocol.
Can we create a private class in C #
Yes.
we can but a private/protected/protected internal class should be a nested class.
Use of out keyword in c#
The main use of out would be where your method needs to return more then one parameter.
See below example of TryParse Method
using System;
public class Example
{
public static void Main()
{
String[] values = { null, “160519”, “9432.0”, “16,667”,” -322 “, “+4302”, “(100);”, “01FA” };
foreach (var value in values)
{
int number;
bool success = Int32.TryParse(value, out number);
if (success)
{
Console.WriteLine(“Converted ‘{0}’ to {1}.”, value, number);
}
else
{
Console.WriteLine(“Attempted conversion of ‘{0}’ failed.”,
value ?? “<null>”);
}
}
}
}
When View Engine come into picture in MVC Lifecycle ?
When we are ready to render a view after execution of controller logic View Engine is involved.The execution of the View Result involves the selection of the appropriate View Engine to render the View Result. If ActionResult returns a ViewResult, execution pipeline selects appropriate ViewEngine to render ViewResult. It is taken care by view engine’s interface IviewEngine.
To improve performance we should remove all ViewEngine that is not needed.
protected void Application_Start()
{
ViewEngines.Engines.Clear();
ViewEngines.Engines.Add(new RazorViewEngine());
}
What is default contenttype in ajax request.
application/x-www-form-urlencoded; charset=UTF-8, is the default one.
Normally we use application/json; charset=utf-8