Loading ...

TrustedBlogs

Who is online?  0 guests and 0 members
home  »  blogs  »  Raghav Khunger: November 2011

Communifire Blogs

Raghav Khunger :November 2011 postings

Raghav Khunger

C#: Casting with ENUM

11/22/2011 by Raghav Khunger · 0 · 660

In this blog I will show how to cast an int to enum, enum to int and string to enum. Let's make a sample enum: MyEnum.cs namespace Sample.Console { public enum MyEnum { Item1 = 1, Item2 = 2, Item3 = 3, Item4 = 4, Item5 = 5, } } 1. Int to Enum int integerValue = 2; MyEnum myenum = (MyEnum)integerValue; //Output: item2 2. Enum to Int MyEnum myenum = MyEnum.Item3; int integerValue = (int)my...

Raghav Khunger

C#: How to get the end of the day

11/22/2011 by Raghav Khunger · 0 · 615

Yeterday I had a requirement where I needed to find the end of day in datetime. I decided to make extension on datetime to achieve it. Below is the sample code: DateTimeExtension.cs: #region Using Directives using System; #endregion namespace Sample.Console { public static class DateTimeExtension { public static DateTime GetEndOfDay(this DateTime datetime) { return datetime.AddDays(1).Ad...

Raghav Khunger

Visual Studio: The breakpoint will not currently be hit. no symbols have been loaded for this document

11/21/2011 by Raghav Khunger · 0 · 684

This message irritates me when I encounter this while debugging my code. I am writing the solution below by which this can be avoided. Step 1: Go to Build >> Configuration Manager and select "Debug " as the option for Active solution configuration. Step 2 : Go to your web project properties >> Build >> General Uncheck the Optimized code checkbox. Step 3: Clean and Rebui...

Raghav Khunger

ASP.NET: Checkboxlist to string list

11/20/2011 by Raghav Khunger · 0 · 865

In this blog I will show how to get selected values of checkboxlist in ASP.NET. The selected value can be get by applying foreach iterator on checkboxlist items and then we can find the selected items. I decided to make an extension to do the same. Below is the code for it: Control Extensions: using System.Collections.ObjectModel; using System.Linq; using System.Web.UI.WebControls; names...

Page 1 of 1 (4 items)

Product Spotlight

ASP.NET Hosting Spotlight

Join CodeAsp.Net for FREE Today!

It's fast, easy and free! Submit articles, get your own blog, ask questions & give answers in the forums, and become a better developer, faster.

enter your email address:

 

Quick Vote

What kind of email newsletter would you prefer to receive from CodeAsp.Net?