Posts

Showing posts from 2023

Optimize Process Speed using C#

To optimized code speed you can use System.Diagnostics  Namespace. ============================= using System; using System.Diagnostics; using System.Threading; namespace DiagnoseProcessSpeed {     internal class Program     {         static void Main()         {             Stopwatch sw = Stopwatch.StartNew(); // Start Stopwatch             for (int i = 1; i < 11; i++)             {                 System.Console.WriteLine("Loop : " + i);                 Thread.Sleep(1000);// interval for 1 seconds.             }             sw.Stop(); // End Stopwatch             //sw.Elapsed Contain Process Taking Time in Seconds             System....

how to fetch all HTML Table Records and modify all records accordingly using jquery and Javascript

In my example, I have fetch HTML Table Records and Convert to Class List Object for C# Result: Click Here < script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js" ></ script > < script >   $ ( document ). ready ( function () {     // Get the table element     const table = document . getElementsByTagName ( "table" )[ 0 ];     // Get all the table rows     const rows = table . rows ;     // Create an empty array to store the table data     const data = [];     // Loop through each row and get the cell data     for ( let i = 0 ; i < rows . length ; i ++) {       const cells = rows [ i ]. cells ;       const rowData = {};       //new Columns { CharacterName = "", Char = "", Code = "", Decimal = "", Binary = "", Hex = "" },       var stringCon = "new Columns {" ;       /...

ASCII Class For C# With Decimal, Binary, Hex Value

public static class ASCII     {         public class Columns         {             public string CharacterName { get; set; }             public string Char { get; set; }             public string Code { get; set; }             public string Decimal { get; set; }             public string Binary { get; set; }             public string Hex { get; set; }         }         public static List<Columns> GetASCIICodeList()         {             List<Columns> ASCII_Code_List = new List<Columns>()             {                 //new Columns { CharacterName = "", Char = "", Code = "", Decimal = ""...

Quick Export to Excel using c#

Image
Export Records in Excel Very Quickly. Step 1: Add Package of EPPlus https://www.nuget.org/packages/EPPlus/ dotnet add package EPPlus --version 6.1.3 ================================================================== Step 2: Implementation on .cs page. using OfficeOpenXml; namespace ExportExcel { private async void Export() { // Collect data from database and store in DataTable object  System.Data.DataTable dt = await GetDataToExport();  using (var package = new ExcelPackage())             {                  // Add a new worksheet to the package                 var worksheet = package.Workbook.Worksheets.Add("Sheet1");                 for (int i = 0; i < dt.Rows.Count; i++)                 {                     await Task.Run(() =>...