Abundant Code

  • C#
  • C++
  • Elastic Search
  • Entity Framework
  • F#
  • JavaScript
  • ASP.NET
  • C
  • Java
  • SQL Server
  • Assembly Lang
Home ยป enum

Converting an Enum to Integer in C#

June 1, 2014 by AbundantCode Leave a Comment

If you need to convert an enum to its numeric equivalent , you can simply cast the values to integer .

Below is a sample code snippet that demonstrates how to do it.

Converting an Enum to Integer in C#

…

Filed Under: C# Tagged With: C#, convert, enum, How to, integer, tutorials

How to Check if the Enum Value is Defined in C# ?

April 1, 2013 by AbundantCode 1 Comment

There are times when it is necessary to check if the constant name or numeric value is defined in the Enum . We can use the Enum.IsDefined method to verify this.

How to Check if the Enum Value is Defined

…

Filed Under: C# Tagged With: C#, Defined, enum

How to display the string value of a Enum in C# ?

October 24, 2012 by AbundantCode Leave a Comment

Below is a sample sourcecode that demonstrates how to display the string value of a Enum in C# ?

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{  
    class Program
    {
        static 
…

Filed Under: C# Tagged With: enum, How to, string

How to Convert Enum to Integer in C# ?

October 24, 2012 by AbundantCode Leave a Comment

Below is a sample sourcecode that demonstrates how to Convert Enum to Integer in C# ?

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{  
    class Program
    {
        static void Main(string[] args)
        
…

Filed Under: C# Tagged With: C#, enum

Assign value to enum in c#

October 24, 2012 by AbundantCode Leave a Comment

You can assign the integer value to enum by casting it to the respective enum type.

For example , In the below sample program , you can assign the value 10 to enum by casting the value to the Designation …

Filed Under: C# Tagged With: C#, enum

RSS
Facebook
fb-share-icon
Twitter
Visit Us
Follow Me
Tweet

Recent Posts

  • InvalidModuleDescriptorException when running java program in Eclipse IDE
  • Python Program to Check Armstrong Number
  • Collapsible links for subcategories in Docusaurus Sidebar
  • Python Program to Print Fibonacci Series
  • Python Program to Generate Multiplication Table

Categories

Tags

.NET App Array ASP.NET ASP.NET MVC Assembly Language C# C# programs c lab programs Collection convert C program csharp database Example F# guide How to How to in Java integer Java Javascript Lab programs Lambda LINQ List Python lab programs Python programs SIC/XE SQL Server string tips tricks tutorial tutorials UWP visual studio 2015 Windows Windows 8 Windows 10 Windows Phone Windows Phone 8 Windows Phone 8.1 wp8 XAML

Blog Stats

  • 8,749,047 hits

Archives

Top Posts & Pages

  • System Software - SIC/XE Program to divide BETA by GAMMA and set quotient and remainder
  • How to Convert a Stream to Byte Array in C# 4.0 ?
  • How to open display settings from command line in Windows 10 ?
  • How to retrieve the URL of the current Page in ASP.NET MVC 4 Controller ?
  • C Program to Multiply Two Matrices Using Multi-dimensional Arrays
  • How to Quickly Delete All Rows in a Table in Entity Framework?
  • How to clean up unused PowerPoint master slides in PowerPoint?
  • How to Allow only numeric input in a Textbox in WPF ?
  • System Software - SIC program to set 100 elements of array to Zero
  • System Software - SIC/XE Program to clear 20 byte string to empty

Categories

  • Android
  • Angular 2
  • ASP.NET
  • Assembly Language
  • C
  • C#
  • C++
  • Elastic Search
  • Entity Framework
  • Excel
  • F#
  • HTML
  • Interview Questions
  • Java
  • JavaScript
  • jQuery
  • Microsoft Office
  • MySQL
  • NETWORK
  • News
  • PHP
  • popular
  • PowerShell
  • Python
  • Ruby
  • SharePoint
  • SQL Server
  • SQL Server
  • Unix
  • VB.NET
  • Visual Studio
  • WebAPI
  • Windows
  • Windows Azure
  • Windows Forms
  • XAML

Top Posts & Pages

  • System Software - SIC/XE Program to divide BETA by GAMMA and set quotient and remainder
  • How to Convert a Stream to Byte Array in C# 4.0 ?
  • How to open display settings from command line in Windows 10 ?
  • How to retrieve the URL of the current Page in ASP.NET MVC 4 Controller ?
  • C Program to Multiply Two Matrices Using Multi-dimensional Arrays
  • How to Quickly Delete All Rows in a Table in Entity Framework?
  • How to clean up unused PowerPoint master slides in PowerPoint?
  • How to Allow only numeric input in a Textbox in WPF ?
  • System Software - SIC program to set 100 elements of array to Zero
  • System Software - SIC/XE Program to clear 20 byte string to empty

Recent Posts

  • InvalidModuleDescriptorException when running java program in Eclipse IDE
  • Python Program to Check Armstrong Number
  • Collapsible links for subcategories in Docusaurus Sidebar
  • Python Program to Print Fibonacci Series
  • Python Program to Generate Multiplication Table
  • Python Program to Find the Factorial of a Number
  • Python Program to Print Prime Numbers in a Given Interval
  • Python Program to Check Prime Number
  • Python Program to Find the Largest Value Among Three Numbers
  • Python Program to Check If a Given Year is Leap Year

Tags

.NET App Array ASP.NET ASP.NET MVC Assembly Language C# C# programs c lab programs Collection convert C program csharp database Example F# guide How to How to in Java integer Java Javascript Lab programs Lambda LINQ List Python lab programs Python programs SIC/XE SQL Server string tips tricks tutorial tutorials UWP visual studio 2015 Windows Windows 8 Windows 10 Windows Phone Windows Phone 8 Windows Phone 8.1 wp8 XAML