Skip to main content

Posts

Showing posts from 2010

Variance in C#.net 4.0 Covariance and Contravariance

Within the type system of a programming language , covariance and contravariance refers to the ordering of types from narrower to wider and their interchangability or equivalence in certain situations (such as parameters, generics, and return types). covariant: converting from narrower (float) to wider (double). contravariant: converting from wider (double) to narrower (float). invariant: Not able to convert (Null). Concept Of Variance : If y is derived from X and y relates to X then we can assign X to y. Like X=y. This is Covariance. If Y is derived from X and y relates to X then we can assign y to X. Like y = X. This is Contravariance. If class A is related to B then B is related A. Covariance Class B: A then we can assign A = B Contravariance Class B: A then we can assign B = A Example Class String : Object Covariance => Object=string; Contravariance=> string=Object; Covariance interface and delegate must have ' In' keyword declaration f

Windows Workflow Foundation (WF)

What’s New in WF4 The significant changes made were necessary to provide the best experience for developers adopting WF and to enable WF to continue to be a strong foundational component that you can build on in your applications. The new framework components are found primarily in the System.Activities.* assemblies while the backwards compatible framework components are found in the System.Workflow.* assemblies.  The System.Workflow.* assemblies are part of the .NET Framework 4 and provide complete backward compatibility so you can migrate your application to .NET 4 with no changes to your workflow code. Designers One of the most visible areas of improvement is in the workflow designer. Usability and performance were key goals for the team for the VS 2010 release.  The designer now supports the ability to work with much larger workflows without a degradation in performance and designers are all based on Windows Presentation Foundation (WPF), taking full advantage of the rich user ex

Windows Communication Foundation

Introductory Videos Creating Your First WCF Service Configuring Services with Endpoints Hosting WCF Services in IIS Self-hosting WCF Services Creating Your First WCF Client Configuring WCF Service References

Memory-Mapped Files

A memory-mapped file contains the contents of a file in virtual memory and is an application’s logical address space. This mapping between a file and memory space enables an application, including multiple processes, to modify the file by reading and writing directly to the memory. Starting with the .NET Framework version 4, you can use managed code to access memory-mapped files in the same way that native Windows functions access memory-mapped files, as described in Managing Memory-Mapped Files in Win32 in the MSDN Library. There are two types of memory-mapped files: Persisted memory-mapped files Persisted files are memory-mapped files that are associated with a source file on a disk. When the last process has finished working with the file, the data is saved to the source file on the disk. These memory-mapped files are suitable for working with extremely large source files. The following illustration shows memory-mapped files that are persisted to disk. Non-persisted memory-mapp