Mohammad Towhidul Islam

    16-Aug-23 02:05:31 pm

    DataTypes - C#.NET

    Primary Data Types: 1. Integer Number a. byte,sbyte b. short, ushort c. int ,uint d. long, ulong 2. Real Number/Floating point a. float b. double c. decimal 3. String/Text 4. Boolean 5. Character Custom Data Type: a. class b. struct ...

    Read More


    Mohammad Towhidul Islam

    03-Aug-22 05:19:18 pm

    virtual and override keyword in C# for implementing Polymorphism

    The virtual keyword is used to modify a method, property, indexer, or event declaration and allow for it to be overridden in a derived class. For example, this method can be overridden by any class that inherits it: class TestClass { public class Shape { public const double PI =...

    Read More


    Mohammad Towhidul Islam

    14-Mar-22 04:51:07 pm

    How to calculate sum of a DataTable's Column in LINQ?

    If untyped (replace int with the correct data type): var sum = table.AsEnumerable().Sum(x=>x.Field<int>(3)); or var sum = table.AsEnumerable().Sum(x=>x.Field<int>("SomeProperty")); If typed: var sum = table.Sum(x=>x.SomeProperty); ...

    Read More


    Mohammad Towhidul Islam

    28-Aug-21 08:38:59 pm

    Anonymous Types in C#

    Anonymous type: var v = new { Amount = 108, Message = "Hello" }; Console.WriteLine(v.Amount + v.Message); Array of anonymous type: var anonArray = new[] { new { name = "apple", diam = 4 }, new { name = "grape", diam = 1 }}; Nested anonymous type: ...

    Read More


    Mohammad Towhidul Islam

    20-Nov-20 02:03:10 am

    Stringify json in C# ASP.net core

    Method 1 using System.Web.Script.Serialization; var json = new JavaScriptSerializer().Serialize(new {name='jahid',age=24}); Method 2 using Newtonsoft.Json; var json=JsonConvert.SerializeObject(new {name='jahid',age=24}); ...

    Read More


    Mohammad Towhidul Islam

    09-Oct-16 01:23:57 pm

    DataView RowFilter Syntax [C#]

    This example describes syntax of DataView.RowFil­ter expression. It shows how to correctly build expression string (without „SQL injection“) using methods to escape values. Column names If a column name contains any of these special characters ~ ( ) # / = > < + - * % & | ^ ' "...

    Read More


    Mohammad Towhidul Islam

    02-Sep-16 11:09:10 am

    Parameters to Queries by SqlCommand

    using System; using System.Data; using System.Data.SqlClient; class ParamDemo { static void Main() { // conn and reader declared outside try // block for visibility in finally block SqlConnection conn = null; SqlDataReader reader = null; string inputCity = "Londo...

    Read More


    Mohammad Towhidul Islam

    21-Aug-16 06:54:43 pm

    DataTable and LINQ

    Example 1 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace DataTableLinq { public partial class Form1 : Form { public Form1() { ...

    Read More


    Mohammad Towhidul Islam

    07-Jul-15 12:22:32 pm

    Consume WCF calculator service by winform

    using CalClient.CalService; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace CalClient { public partial...

    Read More


    Mohammad Towhidul Islam

    07-Jul-15 11:54:09 am

    DisplayMember and ValueMember Attribute in ComboBox

    DataTable table = new DataTable(); table.Columns.Add("operator", typeof(string)); table.Columns.Add("name", typeof(string)); // Here we add five DataRows. table.Rows.Add("+", "Sum"); table.Rows.Add("-", "Subtract"); tabl...

    Read More


First123Last
1 of 3 pages
Copyright © 2024. Powered by Intellect Software Ltd