DotNetShoutout - Stories tagged with enum
3
Shouts

C#/.NET Little Pitfalls: Implicit Zero To Enum Conversion

published 476 days, 4 hours, 42 minutes ago posted by BlackRabbitCoderBlackRabbitCoder 478 days, 2 hours, 17 minutes ago
Saturday, January 28, 2012 11:04:38 PM GMT Friday, January 27, 2012 1:29:56 AM GMT
Many times, we create overloaded methods or constructors to allow them to accept different kinds of data. Further, there are times that we may accept object when any value will do. This works well (aside from boxing/unboxing concerns for value types), but if you have an overload that accepts object and one that takes an enum, and you pass a constant expression of 0, where does it go? (more)
category: Web Dev | clicked: 21 | 1 comment | | source: www.blackrabbitcoder.net
tags: enum, .NET, conversion, C#, Implicit, Little Pitfalls
2
Shouts

Empowering Enums

posted by KodefuGuruKodefuGuru 605 days, 7 hours, 5 minutes ago
Wednesday, September 21, 2011 8:42:11 PM GMT
When reading Steve Smith’s articles on enums on ASP.NET Alliance and his blog, I couldn’t help but think of a different approach to the issue. I’ve seen, used, and coded the enum class pattern before (and it works well), but we have new language features today to encourage reuse and empower true enums. I am going to show you techniques that won’t require significant changes to your code if you have an existing base of enums... (more)
category: How To | clicked: 3 | comment | | source: www.kodefuguru.com
tags: enum, extension method
2
Shouts

Generic Way to Bind Enum With Different ASP.NET List Controls « Abhijit's World of .NET

published 775 days, 8 hours ago posted by abhijitjanaabhijitjana 776 days, 8 hours, 34 minutes ago
Monday, April 04, 2011 7:46:31 PM GMT Sunday, April 03, 2011 7:13:19 PM GMT
In this post I am going to explain how we can bind a Enum with ASP.NET List Controls. These comprise of four different types of control, CheckBoxList, DropDownList, ListBox and RadioButtonList. This is one of the common requirements during development to bind a Enum with List Control and c... (more)
category: Web Dev | clicked: 2 | 1 comment | | source: abhijitjana.net
tags: enum, Tips & Tricks, Linq, bind, ASP.NET
4
Shouts

Using enum flags to write filters in Linq « Timdams's Blog

published 805 days, 6 hours, 32 minutes ago posted by http://timdams.wordpress.com/http://timdams.wordpress.com/ 807 days, 18 hours, 30 minutes ago
Saturday, March 05, 2011 9:15:18 PM GMT Thursday, March 03, 2011 9:17:20 AM GMT
Here’s the premise. Suppose we have a cookbook that contains all possible recipes with their names and needed ingredients. Using Linq it should be easy to query the cookbook and, for example, only show those recipes you can make given one or more ingredients you have at your house. My solution is a) extremely nice or b) very strange, bloated and way wrong. I leave it up to you and make sure to message me if you have a much nicer solution…because franky, I’m not a big fan of what follows (I have the itchi... (more)
category: How To | clicked: 4 | 1 comment | | source: timdams.wordpress.com
tags: enum, Linq
4
Shouts

Enum.HasFlag method in C# 4.0

published 867 days, 22 hours, 56 minutes ago posted by http://jalpesh.blogspot.com/http://jalpesh.blogspot.com/ 869 days, 21 hours, 48 minutes ago
Sunday, January 02, 2011 4:51:00 AM GMT Friday, December 31, 2010 5:59:19 AM GMT
Enums in dot net programming is a great facility and we all used it to increase code readability. In earlier version of .NET framework we don’t have any method anything that will check whether a value is assigned to it or not. In C# 4.0 we have new static method called HasFlag which will check that particular value is assigned or not. Let’s take an example for that. First I have created a enum called PaymentType which could have two values Credit Card or Debit Card. Just like following.public enum Paymen... (more)
category: Web Dev | clicked: 0 | comment | | source: jalpesh.blogspot.com
tags: enum, HasFlag, C#.NET 4.0
3
Shouts

DateTime formatting extension method - Context is King

published 928 days, 8 hours, 8 minutes ago posted by thangchungthangchung 929 days, 16 hours, 2 minutes ago
Tuesday, November 02, 2010 7:38:27 PM GMT Monday, November 01, 2010 11:44:28 AM GMT
Notes: I also updated the pieces of code at http://www.extensionmethod.net/Details.aspx?ID=393 In current project, I get some troubles in DateTime class, about format the date time object with the pattern specific string and the current culture, so I decide to code some extension methods in DataTime class in .NET library. And I think it’s it very useful if somebody can use it as right way. I take some idea from this link and coding the enum class for its. After that I also used the Lambda Expression for... (more)
category: Web Dev | clicked: 0 | comment | | source: weblogs.asp.net
tags: enum, .NET, Extension Methods
4
Shouts

bind Enum to drop down list in ASP.NET

published 996 days, 16 hours, 7 minutes ago posted by PraveenPraveen 997 days, 15 hours, 50 minutes ago
Thursday, August 26, 2010 11:39:36 AM GMT Wednesday, August 25, 2010 11:57:02 AM GMT
Subscribe to my feed here: http://feeds.feedburner.com/praveenbattula This the question asked by so many people around me and I also faced issues couple of times of my early stages of learning.This is simple but, how to get value and names as a collection and bind to drop down list is a bit difficult. Below is the simple logic to read all enums and create a list item and bind to drop down list. [There are many ways to get this done, but I believe below is the best way.] foreach (UserType ut in Enum.G... (more)
category: Web Dev | clicked: 2 | comment | | source: praveenbattula.blogspot.com
tags: enum, dropdownlist, ASP.NET
5
Shouts

Enum.TryParse(.NET 4.0)

posted by http://baldi.myopenid.com/http://baldi.myopenid.com/ 1068 days, 21 hours, 45 minutes ago
Tuesday, June 15, 2010 6:02:18 AM GMT
Since .NET 4.0 the Enum class contains also a TryParse method. The method, which is supported in other basic data types already since version 2.0, allows to pass in a value which will be checked if it can be converted into the defined type. The TryParse method allows you to procude better readable and shorter code. (more)
category: How To | clicked: 1 | comment | | source: www.code-in.net
tags: enum, .Net 4.0