Category Archives: C#

PHPHOST BLOG

Web Hosting Related Articles You May Need

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

LINQ: Calculate Average File Size in C#

Let us see a simple code using LINQ and C# that calculates the average FileSize of the files kept in a folder.

First import the following namespaces:

using System.Linq;
using System.IO;

Then write the following code:

class Program
{
static v… Continue reading

Posted in C#, LINQ, Syndicated | Comments Off on LINQ: Calculate Average File Size in C#

LINQ: Calculate Average File Size in C#

Let us see a simple code using LINQ and C# that calculates the average FileSize of the files kept in a folder.

First import the following namespaces:

using System.Linq;
using System.IO;

Then write the following code:

class Program
{
static v… Continue reading

Posted in C#, LINQ, Syndicated | Comments Off on LINQ: Calculate Average File Size in C#

WCF 4.0 REST POX Service with Help Page

Representational State Transfer (REST) support was included in WCF 3.5. In WCF 4.0, this feature has been enhanced with Help page support. This facility was added as WCF REST allows direct call to OperationContracts, using HTTP protocol by the client a… Continue reading

Posted in .NET, C#, Syndicated | Comments Off on WCF 4.0 REST POX Service with Help Page

WCF 4.0 REST POX Service with Help Page

Representational State Transfer (REST) support was included in WCF 3.5. In WCF 4.0, this feature has been enhanced with Help page support. This facility was added as WCF REST allows direct call to OperationContracts, using HTTP protocol by the client a… Continue reading

Posted in .NET, C#, Syndicated | Comments Off on WCF 4.0 REST POX Service with Help Page

Early June 2011 Software Development Posts of Interest

This post summarizes some blog posts that I have found very interesting in the past week (posts may be older than this, but I saw them in the past week). The topics covered are fairly diverse.

Learning Groovy

I like Vasanth Dharmaraj’s post Learning… Continue reading

Posted in Android, C#, General Development, Groovy, PHP, Syndicated | Comments Off on Early June 2011 Software Development Posts of Interest

List<T>.ConvertAll<>() with Lambda Expression

List<T> has many useful methods for dealing with sequences and collections. One such method is the ConvertAll<>() method. All those who have used the List<T>.ConvertAll<>() are aware how useful this method is to convert the curr… Continue reading

Posted in C#, LINQ, Syndicated | Comments Off on List<T>.ConvertAll<>() with Lambda Expression

List<T>.ConvertAll<>() with Lambda Expression

List<T> has many useful methods for dealing with sequences and collections. One such method is the ConvertAll<>() method. All those who have used the List<T>.ConvertAll<>() are aware how useful this method is to convert the curr… Continue reading

Posted in C#, LINQ, Syndicated | Comments Off on List<T>.ConvertAll<>() with Lambda Expression

Remove all Lower Case Letters using C#

I came across a discussion where the OP wanted to use only the first letter of a word in a string. The first letter of each word was capitalized, so his requirement was to abbreviate the sentence by removing all lower case letters in a string.
For exam… Continue reading

Posted in C#, Syndicated, VB.NET | Comments Off on Remove all Lower Case Letters using C#

Remove all Lower Case Letters using C#

I came across a discussion where the OP wanted to use only the first letter of a word in a string. The first letter of each word was capitalized, so his requirement was to abbreviate the sentence by removing all lower case letters in a string.
For exam… Continue reading

Posted in C#, Syndicated, VB.NET | Comments Off on Remove all Lower Case Letters using C#