Category Archives: C#

PHPHOST BLOG

Web Hosting Related Articles You May Need

Random ASP.NET, MVC & C# Tips in 100 Chars

I had a lot of fun last Friday! The South Asia Microsoft MVP group had organized a Techweet Friday where Microsoft MVP’s would tweet tips about different Microsoft Technologies in 100 chars or less.

I tweeted too and here are some ASP.NET, ASP.NET MVC and C# tips for my non-twitter friends
C# TipsOnce you assign a value to a BigInteger variable, it becomes immutable (cannot change)

‘var’ is not Continue reading

Posted in ASP.Net, ASP.NET AJAX, C#, Syndicated | Comments Off on Random ASP.NET, MVC & C# Tips in 100 Chars

Perform CRUD Operations using OData Services in .NET

In this article, we will see how to perform CRUD Operations using OData Services in .NET applications.

OData (Open Data Protocol) is a web protocol for performing CRUD operations which is built upon web technologies like HTTP, Atom Publishing Protoco… Continue reading

Posted in .NET, C#, Syndicated, WCF | Comments Off on Perform CRUD Operations using OData Services in .NET

ReadOnlyDictionary in .NET 4.5

Yes! For people doing custom implementation to create a Read Only Dictionary, there is now a .NET BCL implementation of the same in .NET 4.5. For the Uninitiated the question is – Why do you need a ReadOnlyDictionary in the first place?A ReadOnlyDictio… Continue reading

Posted in .NET, C#, Syndicated | Comments Off on ReadOnlyDictionary in .NET 4.5

Zip Archives Become a First class citizen in .NET 4.5

Compression in the .NET framework has been supported via different libraries in the past (via Open File Conventions) but the support for .zip archives hasn’t quite been complete. With .NET 4.5 we get a dedicated zip compression library that allows us to manipulate zip libraries fully.

Introduction

Up until now, compression in .NET was supported only to the extent of supporting Open File Continue reading

Posted in .NET, C#, Syndicated | Comments Off on Zip Archives Become a First class citizen in .NET 4.5

Using Caller Info Attributes in C# 5.0 to Improve Logging

The problem of passing current method details haunted my team and me when we were asked to add logging to every available business layer method in a two year old project, that had no logging and empty try { } catch { } blocks. We eventually worked arou… Continue reading

Posted in .NET, C#, Syndicated | Comments Off on Using Caller Info Attributes in C# 5.0 to Improve Logging

Task-Based Asynchronous Pattern in .NET 4.5 – Part 1

In a previous article we saw an overview of the new IDE and Framework features of the current .NET Framework beta v4.5. Among other things .NET 4.5 has an improved support for Asynchronous programming through a new Task based model. In this article, w… Continue reading

Posted in .NET, C#, Syndicated | Comments Off on Task-Based Asynchronous Pattern in .NET 4.5 – Part 1

.NET Programming for Absolute Beginners [Free Video Series]

Channel 9 has just launched an absolute beginner programming series to help people learn to program. This FREE training series is created for programmers who have no experience with C# or VB.NET

The series of 49 episodes (24 episodes for C# and 25… Continue reading

Posted in C#, Free Learning, Syndicated, VB.NET | Comments Off on .NET Programming for Absolute Beginners [Free Video Series]

Which .NET Attributes are my Assemblies Using?

An attribute describes a characteristic of some elements (classes, methods, fields) of a .NET program. Once associated with a program entity, the attribute can be queried at run time and used in any number of ways. In this post, we will learn how to li… Continue reading

Posted in .NET, C#, Syndicated | Comments Off on Which .NET Attributes are my Assemblies Using?

Which .NET Attributes are my Assemblies Using?

An attribute describes a characteristic of some elements (classes, methods, fields) of a .NET program. Once associated with a program entity, the attribute can be queried at run time and used in any number of ways. In this post, we will learn how to li… Continue reading

Posted in .NET, C#, Syndicated | Comments Off on Which .NET Attributes are my Assemblies Using?

C#: Find Previous Month’s First and Last Day

Here’s a simple query that gives you the first and last day of the previous month.

static void Main(string[] args)
{
var yr = DateTime.Today.Year;
var mth = DateTime.Today.Month;
var firstDay = new DateTime(yr, mth, 1).AddMonths(-1);
var lastDay = new DateTime(yr, mth, 1).AddDays(-1);
Console.WriteLine(“First day Previous Month: {0}”, firstDay);
Console.WriteLine(“Last day Previous Month: {0}”, Continue reading

Posted in .NET, C#, Syndicated | Comments Off on C#: Find Previous Month’s First and Last Day