Posts

Showing posts from October, 2012

How to hide generated javascript file in visual studio code

In this post I am going to show you a cool trick in visual studio code. Let's suppose you are writing typescript code in visual studio code and you want to hide generated javascript code.

Create .vscode folder in your folder and then create settings.json file and paste following code

{ "files.exclude": { "node_modules":true, "**/.git": true, "**/.DS_Store": true, "**/*.js.map": true, "**/*.js": {"when": "$(basename).ts"}     } }

How to read incoming and outgoing message in wcf

Image
In this post,I will show you how to read outgoing and incoming message in wcf.Create a new console application and add following assembly reference in the projectusing System.ServiceModel; using System.ServiceModel.Description;and paste following codeusing System; using System.Collections.Generic; using System.Linq; using System.Text; using System.ServiceModel; using System.ServiceModel.Description; namespace WCF_MessageInspector { [ServiceContract] publicinterface IHelloService { [OperationContract] string Greet(string name); } [ConsoleServiceBehavior] [ServiceBehavior] publicclass HelloService : IHelloService { publicstring Greet(string name) { return"Hello ," + name; } } class Program { staticvoid Main(string[] args) { string baseUrl = "http://localhost:12345"; ServiceHost host = new ServiceHost(typeof(HelloService), new Uri(b…

How to read namespace based xml using Linq

In this post,I will show you how to read xml with namespace.For this demo,I will use following xmlstructure<?xml version="1.0" encoding="utf-8" ?> <accounts xmlns="urn:account"> <account>1001</account> <account>1002</account> </accounts> using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Xml.Linq; namespace XLinq { class Program { static void Main(string[] args) { var doc = XDocument.Load("accounts.xml"); var query = from x in doc.Descendants("{urn:account}account") select x; foreach (var item in query) { Console.WriteLine(item); } } } }