473,406 Members | 2,387 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

How to expose an enum

Ant
Hi,
Im wrapping a MailMessage object & need to expose the Priority property.
This property is set to a value of the 'MailPriority' enum. My question is,
how do I create a member that accepts this enum as a value?

as a field named Priority:

public MailPriority Priority; //doesn't work

So that I can set it from the Email instance like this:

myEmail.Priority = MailPriority.High;

Any suggestions would be most appreciated

Ant

Nov 29 '05 #1
3 3430
>public MailPriority Priority; //doesn't work
Why not? What is the complaint?
It should work. You could defined a public property also:
private MailPriority priority
public Priority
{
get {return priority; }
set {priority = value; }
}

If it does not work, pls post the error message.

Thi - http://thith.blogspot.com

Nov 29 '05 #2
Have you define the enum type called MailPriority ??
e.g.
public enum MailPriority
{
High = 1,
Low = 2
};

if you define the enum type in other class .. remember to set a reference to
that class.

Hope it helps,
Ivan Wong

"Ant" wrote:
Hi,
Im wrapping a MailMessage object & need to expose the Priority property.
This property is set to a value of the 'MailPriority' enum. My question is,
how do I create a member that accepts this enum as a value?

as a field named Priority:

public MailPriority Priority; //doesn't work

So that I can set it from the Email instance like this:

myEmail.Priority = MailPriority.High;

Any suggestions would be most appreciated

Ant

Nov 29 '05 #3
Ant
Sorry, my mistake,
I was using it in another class & had forgotten to add the 'using
System.Web.Mail' declaritive in that class. It works fine now.

Thanks for helping out though.
Ant

"Truong Hong Thi" wrote:
public MailPriority Priority; //doesn't work

Why not? What is the complaint?
It should work. You could defined a public property also:
private MailPriority priority
public Priority
{
get {return priority; }
set {priority = value; }
}

If it does not work, pls post the error message.

Thi - http://thith.blogspot.com

Nov 29 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Andreas Huber | last post by:
Hi there Spending half an hour searching through the archive I haven't found a rationale for the following behavior. using System; // note the missing Flags attribute enum Color {
2
by: Gerard Stafleu | last post by:
I have a project with the following module: Module mdlDeclarations Public Enum getMethod gmFirst gmLast End Enum End Module and the following class:
4
by: Don | last post by:
It is possible to expose an enumerated type from within a class library so that other projects referencing that class library will see it in the class's namespace? For example, if I have a class...
6
by: cipher | last post by:
I have some constant values in my web service that my client application will require. Having to keep server side and client side definitions insync is tedious. I am trying to do something like...
4
by: Ohad Redlich | last post by:
hi i have my web service. i want its WSDL to expose, in addition to all the methods and structs, some const-s (ints). can i do that? thanks, Ohad -- visit my photography exhibition at...
34
by: Steven Nagy | last post by:
So I was needing some extra power from my enums and implemented the typesafe enum pattern. And it got me to thinking... why should I EVER use standard enums? There's now a nice little code...
0
by: John Smith | last post by:
What's the magical incantation to be able to expose an enum to COM? namespace NThingy { // I want to be able to access this like an old school midl enum public enum FileStatusCodes { HOLD =...
0
by: John Smith | last post by:
Is there a way to get a C# enum declared inside the class to be accessible inside the COM host? Thanks, tima at predator dash software dot com
1
by: =?Utf-8?B?cHJlZGF0b3Jzdw==?= | last post by:
....just like the MIDL "enum" so I have access to this thing from the host side. Is it as simple as giving the enum a public attribute/guid? thanks! tima at predator dash software dot com
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.