Posts

Showing posts with the label C#

Export data to Excel file with MVC C#

Most of the time  it is required to export data into Excel file in Application. So i have tried many ways but i found very simple code for that. Sometime we need to hit by ajax call sometimes direct action link. so personally i like direct hit we don't need to redirect anywhere on button click. i have use this code to export excel file in mvc. let's go through the code. So on controller level we have to define one method look like- now you can see here i have defined  void type method not ActionResult. ///controller Action Method public void ExportExcel() { Export export = new Export(); export.ExcelExportMethod(Response); } Second we have to create class by Export name and under class create one method looks like- public void ExcelExportMethod(HttpResponseBase Response)     {         var grid = new System.Web.UI.WebControls.GridView();         grid.DataSource = //need to pass Data in list type...

Difference between C# 6.0 and C# 7.0

As You know C# 7.0 have new feature so i will put here major update which is coming in C# 7.0 and also put C# 6.0 feature. for well practice you have to go practically and see hows the things working. let's talk about C# 7.0 feature a. Improved performance and productivity b. Azure support c. AI  support d. Game development e. Cross platform f. Mobile app development g. Window app development and this is C# 6.0 feature a. Static Import b. Exception filters c. Property initializers d. Expression bodies members e. Null propagator f. String interpolation g. Name of operator h. Dictionary initializer so for better understanding you have to go through every point and do it practically. References Link: https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-7 https://www.c-sharpcorner.com/UploadFile/dhananjaycoder/property-initializers-in-C-Sharp-6-0/ Happy Coding 😇