.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

enum enhancements?

Posted By:      Posted Date: April 10, 2011    Points: 0   Category :SharePoint

Has there been any enhancements for enum backward compatibility with .net 4.0?


specifically the datacontractserializer throws an exception if the serialized enum string name is not a valid enum value.  this is done without anyway to hook into it and prevents backward compatibility.

has any setting or way to set the datacontractserializer been added to default the enum?  a DataContractSerializer.DefaultEnums = true would of been great so the default is still the same but gives the option.

if not is there any docs or articles on implementing a custom server-side serializer to do the same as the DataContractSerializer except in this scenario?


Thanks.  we are getting ready to release our services but if this is the case then we will have to go back and change all our enums to strings.



View Complete Post

More Related Resource Links

VB and C# enhancements in VS 2010

In Visual Studio 2010, we've made several enhancements to our two most popular languages, Visual Basic and C#, to give programmers all the tools they need to build great software no matter which language they prefer.

The Visual Basic team focused on adding productivity features to the language so developers can get more done in fewer lines of code. The most common customer request for Visual Basic is to remove the underscore ("_") character when breaking a code statement across multiple lines in most cases. Visual Basic 10 introduces implicit line continuation, which removes the need for the underscore character in most cases.

How to cast integer values as an array of enum values?


Hello all!

I'm working with VS2010 Beta2, ASP.NET and Dynamic Data. I'm using VB but will certainly be happy to receive a C# example if necessary. Laughing

I used a few of Steve's examples (Writing Attributes and Extension Methods for Dynamic Data and Dynamic Data - Hiding Columns in selected PageTemplates) to create a custom property attribute to be applied to a dynamic data column and want it to accept an array of enum values (each value will represent a dynamic data page template where this column should not be displayed).  My new attribute works fine when I hardcode it like this, meaning the HideColumnIn attribute is properly populated with the array of enum values:

<HideColumnIn(PageTemplate.List, PageTemplate.Edit)> _
Public Property My_DD_Column As Object


However, I want to store the values to be used for the HideColumnIn in the DB as integer values that correspond to the

Windows with C++: Windows Services Enhancements


Windows Vista and Windows Server 2008 bring some significant changes that make it simpler to produce services that are more secure and responsive.

Kenny Kerr

MSDN Magazine Launch 2008

Windows with C++: Windows Vista Control Enhancements


With the release of Windows Vista, C++ developers will be happy to know there's plenty of magic left to perform. This new column will provide the necessary insight.

Kenny Kerr

MSDN Magazine August 2007

Security Briefs: Security Enhancements in the .NET Framework 2.0


The.NET Framework 2.0 got quite a few security enhancements. This month Keith takes you on a whirlwind tour of the goodies you'll find there.

Keith Brown

MSDN Magazine Visual Studio 2005 Guided Tour 2006

Security Briefs: Security Enhancements in the .NET Framework 2.0


As I write this column, version 2. 0 of the Microsoft® . NET Framework is at Beta 1. When I got my bits, I hacked together a little program to dump all of the public members of all public types in the entire Framework and ran it on version 1.

Keith Brown

MSDN Magazine January 2005

Data: More Load, Less Code with the Data Enhancements of ASP.NET 2.0


A data source control is a server control that wraps some basic functions of a data source - be it a SQL Server database, an XML document, an Excel worksheet, or a sitemap description. Through the services of a similar component, data-bound controls can fetch data as well as insert new records or update and delete existing ones. Data source controls enable a consistent model across a variety of data sources and dramatically reduce the amount of code needed to implement a two-way data-binding scenario. This article provides an introduction to data source controls and other related data binding features.

Dino Esposito

MSDN Magazine June 2004

Visual C++ .NET: Language Enhancements and Simplified GUI Development Enrich Your C++ Apps


Managed Extensions for C++ is the preferred programming language for developing Windows Services. Visual Studio .NET 2003 introduces C++ support for designers, providing all the RAD facilities that were available to other languages for developing forms, controls, components, and DataSets. Furthermore, support has been added for the creation of verifiable assemblies with C++.In this article, the author reviews these additions as well as the new compiler and linker switches, demonstrating how C++ remains the premier systems language while becoming a powerful tool for .NET GUI development as well.

Richard Grimes

MSDN Magazine March 2003

Visual Basic .NET: New Programming Model and Language Enhancements Boost Development Power


Visual Basic .NET is the result of a significant rebuild of Visual Basic for the Microsoft .NET Framework. There are a number of changes that make Visual Basic .NET easier to use, more powerful than Visual Basic 6.0, and give it the kind of access to system resources that in the past required the use of languages like C++. One of the most important additions is object inheritance. In Visual Basic .NET, all managed types derive from System.Object. An important new language feature is garbage collection, which is administered by the Common Language Runtime and provides better memory management. The universal type system allows for greater interoperability, also contributing to the enhanced power and flexibility found in Visual Basic .NET.

Ted Pattison

MSDN Magazine February 2001

enum and switch need help

void Main()
	string t = "Vendor";
	switch (t)
		case PType.Client :
		case PartyType.Vendor :

public enum PType

When I try to run these code got error:  cannot implicitly convert type PType to string

If I change PType.Client to PType.Client.ToString() got error: A constant value is expected


how to use enum in class


hi there
in my class i have this code

  public enum userTypeID
            Superuser = 1,
            User = 2
        public userTypeID Tipo;

and i am trying to use with

int use= int.Parse(CLS_UserType.userTypeID.Superuser)

it return error because it is not possible cast int to enumeration
how can i do to get a value?

Comparing Enum values in a collection - BC42025: Access of shared member, constant member, enum mem


I am upgrading from asp1.1 to 2.0

I use collection classes to sort data (e.g in datagrids etc)


Enum newsFields
End Enum

Public Overloads Sub Sort(ByVal sortField As newsFields, ByVal isAscending As Boolean)
Select Case sortField
Case newsFields.title

RFC: I want your FB on "RS Parameters Enhancements" for the next major release

Hello,RS product team is looking into doing some substantive work in the next release of Reporting Services, related to enhancing parameters. This could include changes to RDL, design tools like BIDS and RB, SOAP API's, Report Manager and SharePoint UI's, and of course the Report Server internals. Without making any commitments, I'll just lob a few "top of the list" features out there to prime the pump:Prompt localizabilityValidation (value ranges, defining invalid values, extensible validation through assemblies, etc.)Tree view of heirarchical parametersHistory and Execution snapshot parameter controlSelect All configuration -- yes or no, top or bottom, etc.Multivalue usabilityPLZ reply to this thread with your "wish list" for better RS parameters. I'd also very much like to see sample reports that use parameters in creative ways, especially if you had to do extra work to compensate for missing features or unexepected behaviors. I'll take all the FB, filter it through the list we already have, and hopefully come up with a list of features we can pull off in time for the next major release that meets as much of your needs as possible.Thanks for your consideration, and regards.Mike

Bug: Specifying values in the definition of an enum in Web Parts in subsites

Pardon the cumbersome title, but I wanted to make it as descriptive as possible! Anyway, I stumbled upon this bug and spent a good while trying to figure out what was wrong. I'm developing a WebPart for use in MOSS 2007. The WebPart in question is mostly unremarkable, but I was getting the following error when editing the WebPart properties: "Some of the properties for this Web Part cannot be displayed properly. For more information, see your site administrator." I've searched Google, Bing and Yahoo for this error and have found nothing, so hopefully this post will be of use to anyone else who searches for it. Turns out the problem was in the enumerator definition. It looked like this:   public enum KPIPalette { Grey = 1, Green, Blue, Orange }   The colour palettes of the components we're using started at 1, so I set the enumerator to do that also. SharePoint, however, had other ideas. The solution is to leave enumerator definitions out. When the number was required later in code, a 1 was added. Error begone, problem solved!

How to cast integer values to an array of enum values?

Hello all! I'm new to VB.NET (and OOP in general) and am struggling a bit...  I'm working with VS2010 Beta2, ASP.NET and Dynamic Data, however I'm thinking this question may be more related to VB so hopefully I've chosen the correct forum. I have a list of integer values stored in the DB and would like to cast them to an array of enum values so that they may be passed to my constructor.  The values in the DB directly correspond to the enum values.  Here is stripped down version of the code that hopefully highlights what I'm attempting to do:Private _pageTemplate() As PageTemplate Public Sub New(ByVal ParamArray pageTemplateArray As PageTemplate()) _pageTemplate = pageTemplateArray End Sub Public Enum PageTemplate Details = 1 Edit = 2 Insert = 3 List = 4 ListDetails = 5 End Enum What I'm having difficulty with is reading integer values from the DB and casting them to an array of PageTemplate() to be passed to the constructor above.  The integer values in the DB will be 1 through 5 to correspond to the enum values listed above.  Here is how I'm trying to build the ParamArray to be passed to the attribute constructor:Dim hideFieldsIn(-1) As PageTemplate Dim rowCount As Integer = -1 If reader.HasRows Then While reader.Read() rowCount += 1 ReDim hideFieldsIn(rowCount)
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend