Just about a month ago, WinRT was introduced with all new style of application development that can work better with Multi Touch Enabled devices. We call it as Metro Applications. In this post, I will discuss how to develop your first metro applications and how to work with its layout changes.
How to Start
Before we start talking directly about Metro Style application, let us see how to install it first. I refer to use OracleVM which you can find for free from this link, and install. This will install a Virtual Machine in which you can install the Developer Preview of Windows 8.
Handy Tricks and Tips to do your .NET code Fast, Efficient and Simple. Some common questions that comes into mind. Please check if you could find them listed or not.
Sunday, October 30, 2011
Friday, October 21, 2011
Regular Expressions with Timeout in .NET 4.5
.NET 4.5 Developer preview is out with Visual Studio 2011. I was already thinking to try out what's new in .NET 4.5 myself and share what exactly been changed.
Lets start by the new Regex Api introduced with the framework. The improvement that has been made is minor yet handy at certain cases. The Regex class of .NET 4.5 supports Timeout. Lets take a look how to work with it.
Lets start by the new Regex Api introduced with the framework. The improvement that has been made is minor yet handy at certain cases. The Regex class of .NET 4.5 supports Timeout. Lets take a look how to work with it.
Friday, October 7, 2011
Generic Types and Static Members
One of my friend recently asked me a question that I think I should share with you. Say you have a Static Implementation of a Type T which you pass as Open Type in your Generic Class. Now the problem is how to get reference to the Static Members or invoke a method that is Static to the Type from the Open Type T. In this post, I will demonstrate few implementations that help you getting the Static implementation.
First of all, According to C# documentation, any type allocates its static members once per Type rather than once per Open Type. Now lets define this using the code below :
First of all, According to C# documentation, any type allocates its static members once per Type rather than once per Open Type. Now lets define this using the code below :
Monday, September 26, 2011
Internals of .NET Objects and Use of SOS
Well, now getting deeper into the facts, lets talk about how objects are created in .NET and how type system is laid out in memory for this post in my Internals Series. As this is going to be very deep dive post, I would recommend to read this only if you want to kill your time to know the internal details of .NET runtime and also you have considerable working experience with the CLR types and type system.
Recently I have been talking with somebody regarding the actual difference between the C++ type system and managed C# type system. I fact the CLR Type system is different from the former as any object (not a value type) is in memory contains a baggage of information when laid out in memory. This makes CLR objects considerable different from traditional C++ programs.
Classification of Types
In .NET there are mainly two kind of Types.
Recently I have been talking with somebody regarding the actual difference between the C++ type system and managed C# type system. I fact the CLR Type system is different from the former as any object (not a value type) is in memory contains a baggage of information when laid out in memory. This makes CLR objects considerable different from traditional C++ programs.
Classification of Types
In .NET there are mainly two kind of Types.
- Value Types (derived from System.ValueType)
- Reference Type (derived directly from System.Object)
Even though ValueTypes are internally inherited from System.Object in its core, but CLR treats them very differently. Indeed from your own perception the Value Types are actually allocated in stacks (occationally) while reference types are allocated in Heaps. This is to reduce the additional contension of GC heaps for Heap allocation, GC cycles, occasional call to OS for additional memory needs etc. The object that is allocated in managed Heap is called Managed Object and the pointer that is allocated in stack to refer to the actual object in heap is called Object Reference (which is sometimes called as Managed Pointer).
Saturday, September 24, 2011
Internals of Interface and its Implementation
As many of my followers requested me to write few things that I missed out from the Internals Series, I should continue with it. In this post, I will cover the internals of Interface implementation and mostly talk about explicit interface implementation, as most of the developers seems to be in confusion with it. I hope you will like the post.
Beginning from the basics, Interfaces are the most important part of any application. Interfaces are language construct that does not implement anything but declares a few members upfront. Generally we use interfaces to create a contract between the two or more communication agents. Another important thing that everyone would be knowing already, Interfaces are meant to be implemented. That means whenever you are creating a class, all the members that were there in the interface are meant to be implemented completely. .NET (or probable any other standard language) disallows the creation of objects on types that are not fully defined. Hence abstract classes also coming into play here. They are classes that have few members undefined or abstract. Once you don't have concrete implementation, you cannot create an instance of a type. Notably, you can say "Interface is a types that does not belong to the System.Object or implement it when it reside inside an assembly". But ironically you could also says that once the type is implemented, it would probably inherit from System.object by default.
Beginning from the basics, Interfaces are the most important part of any application. Interfaces are language construct that does not implement anything but declares a few members upfront. Generally we use interfaces to create a contract between the two or more communication agents. Another important thing that everyone would be knowing already, Interfaces are meant to be implemented. That means whenever you are creating a class, all the members that were there in the interface are meant to be implemented completely. .NET (or probable any other standard language) disallows the creation of objects on types that are not fully defined. Hence abstract classes also coming into play here. They are classes that have few members undefined or abstract. Once you don't have concrete implementation, you cannot create an instance of a type. Notably, you can say "Interface is a types that does not belong to the System.Object or implement it when it reside inside an assembly". But ironically you could also says that once the type is implemented, it would probably inherit from System.object by default.
Labels:
.NET,
.NET 4.0,
beyondrelational,
C#,
CodeProject,
internals
Monday, September 12, 2011
Writing a Custom ConfigurationSection to handle a Collection
Configuration is one of the major thing that you need to keep in mind while building any application. Either its an Windows Forms application or a Web site, configuration file is always needed. We write all the configuration that are needed to be changed after it is being deployed in confugration files. It is an XML File which lists all the configuration blocks itself and also allows you to define your own custom configuration sections yourself. Today I am building my own custom configuration section and show how easily you can build yourself.
While dealing with Configurations, there are two things that you need to address
For most of the simple configurations, it is pretty much common to use these two classes, but when you need more complex configuration block, like appsettings which actually puts a Collection of ConfigurationElements, you might need to use ConfigurationElementCollection to hold the collection of ConfigurationElement.
- ConfigurationSection
- ConfigurationElement
- ConfigurationElementCollection
For most of the simple configurations, it is pretty much common to use these two classes, but when you need more complex configuration block, like appsettings which actually puts a Collection of ConfigurationElements, you might need to use ConfigurationElementCollection to hold the collection of ConfigurationElement.
Labels:
.NET,
.NET 4.0,
architecture,
beyondrelational,
C#,
CodeProject,
Configuration,
WPF,
XAML
Thursday, September 1, 2011
31 Tips for the month on Threading, WPF, MEF, ASP.NET
Daily .NET Tips is aiming to sharing useful coding tips and tricks for .NET Developers. This site completely design for sharing Tips and Tricks, useful Code Snippet which anyone use in daily development work and targeted anything related with .NET. This month we have wide range of tips including Threading, MEF, WPF and MVC. In this post I am quickly listing down all the tips which are published over the month August 2011. And the most important point to mention, among those 31 tips that has been posted on DailyDotnettips this month 22 is coming from me.
- Working with AggregateCatalog in MEF
- Working with DirectoryCatalog in MEF
- Working with AssemblyCatalog in MEF
- Working with TypeCatalog in MEF
- How to use DebuggerTypeProxy while debugging your sensitive Type
- ASP.NET Calendar Control as Outlook Calendar
- Initialize assemblies using PreApplicationStartMethod for ASP.NET 4.0 Application
- Async Lambda Expression
- Playing with ASP.NET List Controls using jQuery
- How to allow user to input html in ASP.NET MVC?
- Using Mutex to avoid deadlocks
- Writing inline Code in WPF
- What is SynchronizationContext all about
- ThreadLocal storage in .NET
- Barrier in .NET 4.0
- Use of Interlocked in Race Condition
- Call ASP.NET Page Methods using your own AJAX
- Use of SpinLock for ThreadLocking
- Using ReaderWriterLock over Monitor for Thread Locking
- What is the use of IsBackground property of Thread?
- Enable Address Level Debugging in Visual Studio
- Get List of all Control Types in WPF
- How to apply simple faded transparent effects on WPF controls ?
- Use Visual Studio Server Explorer to Add New or Existing SQL Server CE Database
- Co-Ordinated Thread Shutdown with and without using CancellationTokenSource
- Generate thousand of request
- Writing a Stretchable ContentControl in WPF
- How to Retrieve WPF Visual Tree Programmatically ?
- What is Visual Tree and Logical Tree in WPF?
- Dealing with HWND in WPF
- Hosting a WPF control inside a Windows Form
To get regular updates visit http://dailydotnettips.com and follow @dailydotnettips at Twitter.
I hope you would like the posts. Stay tune for more.
Labels:
.NET 4.0,
architecture,
ASP.NET 4.0,
C#,
MEF,
Patterns,
Reflection,
Threading,
tips,
WPF,
XAML
Subscribe to:
Posts (Atom)
Author's new book
Abhishek authored one of the best selling book of .NET. It covers ASP.NET, WPF, Windows 8, Threading, Memory Management, Internals, Visual Studio, HTML5, JQuery and many more...
Grab it now !!!
Grab it now !!!