Tuesday, 28 April 2015

DataContractSerializer vs XmlSerializer in WCF

DataContractSerializer Is meant to be used for serialization/deserialization of class in WCF service to and from either JSON or XML. serializes properties and fields. Is faster than XmlSerializer Doesn't control how xml is generated. Should not be used when full control on generated XML structure is required XMLSerializer XmlSerializer is only for XML serialization Supports full control over...
Continue Reading →

Custom HTML Helpers in ASP.NET MVC

How many times did you wonder how to avoid writing the same chunk of HTML / JavaScript code many times in an MVC Razor view? What if this repetitive task includes some logic? The solution to avoid this is to build a custom HTML helper to encapsulate everything and make the repetitive task less cumbersome. Let's say we want to avoid doing this many times inside your views:   <img...
Continue Reading →

WCF Service – KnownType DataContract

Data Contract describes the type of data that will be sent or received between a service and a client. But in certain scenarios, sent or received data is not known between the the communicating parties. For example, a service sending data back to client is not the actual data contract but a derived type of it. In such cases, there will be a De-serialization problem. De-serialization engine will...
Continue Reading →

Monday, 20 April 2015

C# Collections that Every Developer Must Know

C# Collections that Every C# Developer Must KnowListDictionaryHashSetStackQueueList<T>Represents a list of objects that can be accessed by an index. <T> here means this is a generic list. Unlike arrays that are fixed in size, lists can grow in size dynamically. That’s why they’re also called dynamic arrays or vectors. Internally, a list uses an array for storage. If it becomes full,...
Continue Reading →

Wednesday, 15 April 2015

Difference between bind(),on(), delegate() in Jquery

bind() method: This method only attaches events to elements which exist beforehand i.e. state of initialized document before the events are attached. If the selector condition is satisfied for an event afterward, bind() will not work on that function. It also won’t work in the case if selector condition is removed from the element.<script>    $("#foo").bind("mouseenter mouseleave", function () {        $(this).toggleClass("entered");    });    $("#foo2").bind({        click: function () {            // Do something on click        },        mouseenter: function () {            // Do something on mouseenter        }    });    $("#foo").bind("click", function () {        alert($(this).text());    });</script>on()...
Continue Reading →

Tuesday, 14 April 2015

Abstract Vs. Static

Can you create abstract function as Static? A static member cannot be marked as override, virtual, or abstract. Can you create static function in Abstract class? Yes. Example:  namespace ConsoleApplication2{    public abstract class ps    {        public ps()        {        }        public ps(string a)        {        }        public abstract string getMessage();        public static void Helloworld() { Console.WriteLine("hello"); }         //A static member cannot be marked as override, virtual, or abstract        //public static abstract void Helloworld() { Console.WriteLine("hello"); }        //public static abstract string GetName();    }    public class Program :ps    {        static void Main(string[] args)        {            Program p = new Program();            Console.WriteLine(p.getMessage());            Helloworld();            Console.Read();        }        public override string getMessage()        {            return "message hello.";        }    }} Is...
Continue Reading →

Thursday, 2 April 2015

Console Program

1: Program to find remainder without using modulo or % operatorclass Program{    // This function returns remainder of    // num/divisor without using %    // (modulo) operator    static int getRemainder(int num, int divisor)    {        return (num - divisor * (num / divisor));    }    //initialize an array...
Continue Reading →

Use of c# “Yield” keyword ?

Yield is one of the most useful but under-used keywords in C#. The reason is that most of us don't even know about this keyword and the purpose it can serve for us.The functionality provided by Yield keyword is that when iterating a list, we can read an element of the loop, return to the calling code and go back to the loop again at the same point, from where it left the loop and continue processing...
Continue Reading →

Topics

ADFS (1) ADO .Net (1) Ajax (1) Angular (47) Angular Js (15) ASP .Net (14) Authentication (4) Azure (3) Breeze.js (1) C# (55) CD (1) CI (2) CloudComputing (2) Coding (10) CQRS (1) CSS (2) Design_Pattern (7) DevOps (4) DI (3) Dotnet (10) DotnetCore (20) Entity Framework (5) ExpressJS (4) Html (4) IIS (1) Javascript (17) Jquery (8) jwtToken (4) Lamda (3) Linq (10) microservice (4) Mongodb (1) MVC (46) NodeJS (8) React (10) SDLC (1) Sql Server (32) SSIS (3) SSO (1) TypeScript (3) UI (1) UnitTest (2) WCF (14) Web Api (16) Web Service (1) XMl (1)

Dotnet Guru Archives