Showing posts with label Window. Show all posts
Showing posts with label Window. Show all posts
Friday, June 18, 2010

Union,Except and Intersect operator in Linq

While developing a windows service using Linq-To-SQL i was in need of something that will intersect the two list and return a list with the result. After searching on net i have found three great use full operators in Linq Union,Except and Intersect. Here are explanation of each operator.

Union Operator: Union operator will combine elements of both entity and return result as third new entities.

Except Operator: Except operator will remove elements of first entities which elements are there in second entities and will return as third new entities.

Intersect Operator: As name suggest it will return common elements of both entities and return result as new entities.

Let’s take a simple console application as a example where i have used two string array and applied the three operator one by one and print the result using Console.Writeline. Here is the code for that.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace ConsoleApplication1
{
 class Program
 {
     static void Main(string[] args)
     {
         string[] a = { "a", "b", "c", "d" };
         string[] b = { "d","e","f","g"};

         var UnResult = a.Union(b);
         Console.WriteLine("Union Result");
         foreach (string s in UnResult)
         {
             Console.WriteLine(s);           
         }

         var ExResult = a.Except(b);
         Console.WriteLine("Except Result");
         foreach (string s in ExResult)
         {
             Console.WriteLine(s);
         }

         var InResult = a.Intersect(b);
         Console.WriteLine("Intersect Result");
         foreach (string s in InResult)
         {
             Console.WriteLine(s);
         }
         Console.ReadLine();
        
     }

 }
}

Here is the output of console application as Expected.

LinqOperators

Hope this will help you.. Stay tuned for more!!


Share:
Wednesday, May 27, 2009

Increase Performance in asp.net application

For every enterprise level application the key to make that application success is the responsiveness of application. ASP.NET also offers great deal of the features for developing web based enterprise application but some times due to avoiding best practice to write application the performance of application performance of application is not so fast as it should be. Here are the some use full suggestion to make your application super fast.

  1. Always set debug=”false” in web.config production environment.
  2. Always set trace=”false” in web.config production environment
  3. If you are using asp.net 2.0 or higher version then always use precompiled version of your code and also prefer web application project over website. If you are using website then always publish it and then upload that precompiled version of your site in production environment.
  4. Always compile your project in Release Mode before uploading application to production environment.
  5. Decrease your html kb as much as you can for that use tables less html using div’s and if possible then do not give big name to your control it will increase your html kb as asp.net uses client Id to differentiate all the controls. If you are creating custom controls then you can overwrite your clientid and uniqueId.
  6. Use cache api as much as possible it will decrease your server roundtrip and boost application performance. ASP.NET 2.0 or higher version provides functionality called sqlcachedependancy for your database caching. It will validate cache with your database operation like insert,update and delete and if not possible with it then use the file base caching.
  7. Remove blank spaces from your html it will increase your kb. You can use regular expression to remove white spaces. I will post the code for removing white spaces next posts.
  8. For asp.net 2.0 and higher version use master pages. It will increase your performance.
  9. Prefer database reader over dataset unless and until you have specific reason to use database.
  10. Use ADO.NET asynchronous calls for ado.net methods. asp.net 2.0 or higher version is supporting your performance. If you are using same procedure or command multiple time then use ADO.NET Prepare command it will increase your performance.
  11. Do IIS performance tuning as per your requirement.
  12. Disable view state for your controls if possible. If you are using asp.net 2.0 or higher version then use asp.net control state instead of view state. Store view state in session or database by overriding the default methods for storing view state.
  13. User Server.Transfer instead of response.redirect.
  14. Always use inproc session state if possible.
  15. Use Ajax for your application wisely. Lots of Ajax calls for a page will also decrease your performance.
  16. Measure your application performance with tools like redgate profiler,firebug and whyslovw from yahoo.
  17. User System.Text.StringBuilder for string concatenation its 4 times more faster then the normal strings.
  18. Right JavaScript in .Js files and place it as bottom of the application.
  19. Use Separate CSS files for styling of application.
  20. User database paging over normal paging while displaying huge amount of data.
  21. Call web service from java script instead of server side. Use asynchronous calls to call a web method from web service.

That’s it!!…..Happy Programming..

Share:
Friday, February 15, 2008

Creating Web Services in a Class Library project

When you are developing a plug in or add in for a software some time you have a requirement for developing webservice hosting in DLL. I have found a great link which describes all the things.

here is the link..

http://www.codeproject.com/KB/aspnet/wsinaclasslibrary.aspx

Share:
Friday, July 13, 2007

New Version of Microsoft Acropolis it out

The Microsoft code name “Acropolis” Community Technology Preview is a set of components and tools that make it easier for developers to build and manage modular, business focused, client .NET applications. Acropolis is part of the “.NET Client Futures” wave of releases, our preview of upcoming technologies for Windows client development.

Microsoft Announces new version ctp of Microsoft acropolis. For more details and download
ctp of Microsoft Acropolis please visit following link:

http://windowsclient.net/acropolis/
Share:
Tuesday, June 12, 2007

Micorsoft Server Operating System-Windows Server 2008

Microsoft has announced its new generation of server operating system called windows server 2008. Microsoft windows server 2008 beta 3 is available for download.

Following are the some of windows server 2008 highlights.

1) Increase Control and Manageability
2) Flexibility for Changing Business Needs
3) A Solid Foundation on Which to Build Your Business


For more details about windows sever 2008 family and download beta 3 version of windows server 2008 please visit following link...

http://www.microsoft.com/windowsserver2008/default.mspx
Share:
Wednesday, June 6, 2007

Micorosft Acropolis CTP 1 released.


Microsoft code name “Acropolis” Community Technology Preview 1 is a bundle of components and tools that make life easier for developers to build and manage modular, business focused, client .NET smart applications.

To Download Acropolis click Here


To Know more about acropolis download Introducing video from here

Share:

Windows Presentation Foundation- All About

The primary goal of Windows Presentation Foundation (WPF) is to help developers create attractive and effective user interfaces. Learn how the WPF unified platform helps make designers active participants in creating user interfaces, and provides a common programming model for standalone and browser applications.

It is a great articles which describes all the aspects of WPF and also give glimpse on how user can developed smart application with Windows Presentation Foundation.

Here is the link for article:
http://msdn2.microsoft.com/en-us/library/aa663364.aspx
Share:
Thursday, May 17, 2007

WPF - Hands on Labs

Microsoft Windows Foundation Presentation (WPF) hands on labs is a great labs to know more about Windows Presentation Foundation and How we should integrate it into the windows forms.

for all the details visit following links:
http://windowsclient.net/downloads/folders/hands-on-labs/default.aspx

Microsoft has provided following hands on labs

1) Building WPF Applications
2) Building WPF XAML Browser Applications
3) Creating 3D Content with Windows Presentation Foundation
4) Creating a Glass Button in Blend
5) Creating Rich 2D and 3D Content in WPF
6) Creating Rich Reading Experience with WPF
7) Creating Rich Reading Experience with WPF
8) Creating WPF buttons with Expression Blend and Expression Design
9) Expression Blend Feature Tour - Fabrikam Catalog
10)Using Data Binding in WPF

Happy Programming..
Share:

Windows Forms Video

For those who are new to the programming. Video Tutorials provides great helps. Microsoft has lots of videos on his new resource site. http://www.windowsclient.net/.

It has following videos...

1) Windows Presentation Foundation for Developers – Part 1
2) Design Rich Client Experiences with Expression Blend and WPF
3) A View from the Front: Real World Experiences of WPF and Silver light
4) Starbucks, Windows Presentation Foundation, and Stand Out: Remarkable Brand Delivers Remarkable Presentations
5) ZAP!, WHAM!, KAPOW!: Windows Presentation Foundation and the Next Generation of Online Comic Book Reading
6) Citius, Altius, Fortius: Windows Presentation Foundation and the 2008 Olympic Games
7) Lessons Learned: Designer/Developer Productivity in Windows Presentation Foundation
8) Family Show: I See Dead People, with Windows Presentation Foundation
9) Windows Presentation Foundation in Real World Development
10) WPF State of the Nation
11) Interactive 2D controls on WPF 3D Surfaces
12) Creating a Simple XAML Browser Application
13) Advent and Evolution of WPF
14) IronPython and WPF
15) The Power of Templates in Windows Presentation Foundation
16) Sneak Peak at Cider
17) Testing WPF - UI Fuzzing with InvokeStress
18) Demo of Avalon 3D
19) Expression – Part One: The Overview
20) Expression – Part Two: Design
21) Expression – Part Three: Blend
22) Windows Forms Layout
23) Tool Strips
24) Windows Presentation Foundation: The Opportunity for WPF Applications in the ...
25) Developing a Windows Presentation Foundation Application
26) A Designer's Overview of Windows Presentation Foundation
27) Building a Real World WPF Application: The North Face In-Store Explorer

For more details about the videos please visit following link:
http://windowsclient.net/learn/videos.aspx

Happy Programming...
Share:

1.0 windows starter kits from windowsclient.net

Just like the asp.net starter kits windows forms starter kits provide a very good way to learn windows forms programming. Those who are new to the windows forms programming by .net technology must have the windows forms start kits.

Windows starter kits include following applications...

1) Auto-Column-Size Windows Forms DataGrid
2) DataGrid ComboBox Column
3) FotoVision
4) Infragistics Tracker Application
5) IssueVision
6) ITypedList Implementation
7) TaskVision 1.0
8) Terrarium

To know more about start kits please visit:
http://windowsclient.net/downloads/folders/starterkits/default.aspx

or directly download starter kits from above links..

Happy Programming.
Share:

Support this blog-Buy me a coffee

Buy me a coffeeBuy me a coffee
Search This Blog
Subscribe to my blog

  

My Mvp Profile
Follow us on facebook
Blog Archive
Total Pageviews