Hello.
I have a quick and "simple" question that will probably boil down to opinion
more than anything else. I need a FieldType property for a class I am
writing. As such an Enum would be the perfect solution for this property. In
C# I can write
Public Enum FieldType
Integer = 0
Float
Double
String
Date
ObjectId
End Enum
And everything works like a charm. I have been requested to rewrite this in
VB.NET. However, VB.NET is not case sensitive so that structure does not
work because Interger, Double, String and Date are reserved types regardless
of case. Is there a defined recommended alternative for this? Prefix or
Suffix? What do you think about?
Public Enum FieldType
enumInteger = 0
enumFloat
enumDouble
enumString
enumDate
enumObjectId
End Enum
or
Public Enum FieldType
_Integer = 0
_Float
_Double
_String
_Date
_ObjectId
End Enum 6 1899
"Ryan Taylor" <rt*****@stgeor geconsulting.co m> schrieb: I need a FieldType property for a class I am writing. As such an Enum would be the perfect solution for this property. In C# I can write
Public Enum FieldType Integer = 0 Float Double String Date ObjectId End Enum
And everything works like a charm. I have been requested to rewrite this in VB.NET. However, VB.NET is not case sensitive so that structure does not work because Interger, Double, String and Date are reserved types regardless of case.
Put the keywords between square brackets to escape them:
\\\
Public Enum FieldType
[Integer] = 0
Float
[Double]
...
End Enum
///
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
"Ryan Taylor" <rt*****@stgeor geconsulting.co m> schrieb: I need a FieldType property for a class I am writing. As such an Enum would be the perfect solution for this property. In C# I can write
Public Enum FieldType Integer = 0 Float Double String Date ObjectId End Enum
And everything works like a charm. I have been requested to rewrite this in VB.NET. However, VB.NET is not case sensitive so that structure does not work because Interger, Double, String and Date are reserved types regardless of case.
Put the keywords between square brackets to escape them:
\\\
Public Enum FieldType
[Integer] = 0
Float
[Double]
...
End Enum
///
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
You can use parenthesis and it will work:
Public Enum FieldType
[Integer] = 0
[Float]
....
--
Best regards,
Carlos J. Quintero
MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers: http://www.mztools.com
"Ryan Taylor" <rt*****@stgeor geconsulting.co m> escribió en el mensaje
news:uq******** ******@TK2MSFTN GP15.phx.gbl... Hello.
I have a quick and "simple" question that will probably boil down to opinion more than anything else. I need a FieldType property for a class I am writing. As such an Enum would be the perfect solution for this property. In C# I can write
Public Enum FieldType Integer = 0 Float Double String Date ObjectId End Enum
And everything works like a charm. I have been requested to rewrite this in VB.NET. However, VB.NET is not case sensitive so that structure does not work because Interger, Double, String and Date are reserved types regardless of case. Is there a defined recommended alternative for this? Prefix or Suffix? What do you think about?
Public Enum FieldType enumInteger = 0 enumFloat enumDouble enumString enumDate enumObjectId End Enum
or
Public Enum FieldType _Integer = 0 _Float _Double _String _Date _ObjectId End Enum
You can use parenthesis and it will work:
Public Enum FieldType
[Integer] = 0
[Float]
....
--
Best regards,
Carlos J. Quintero
MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers: http://www.mztools.com
"Ryan Taylor" <rt*****@stgeor geconsulting.co m> escribió en el mensaje
news:uq******** ******@TK2MSFTN GP15.phx.gbl... Hello.
I have a quick and "simple" question that will probably boil down to opinion more than anything else. I need a FieldType property for a class I am writing. As such an Enum would be the perfect solution for this property. In C# I can write
Public Enum FieldType Integer = 0 Float Double String Date ObjectId End Enum
And everything works like a charm. I have been requested to rewrite this in VB.NET. However, VB.NET is not case sensitive so that structure does not work because Interger, Double, String and Date are reserved types regardless of case. Is there a defined recommended alternative for this? Prefix or Suffix? What do you think about?
Public Enum FieldType enumInteger = 0 enumFloat enumDouble enumString enumDate enumObjectId End Enum
or
Public Enum FieldType _Integer = 0 _Float _Double _String _Date _ObjectId End Enum This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Alexander Grigoriev |
last post by:
Not quite new version of GCC that I have to use, craps with the following
code:
enum E;
enum E { e };
That is, it doesn't accept forward declaration of enum. C++ standard text
doesn't explicitly say about enum's forward declaration, but one example
shows it in 18.2.1, clause 4:
|
by: Vaclav Haisman |
last post by:
Motivation:
I have been working on some project recently that uses lots of enums with
disjunctive intervals of values because it is rather convenient way to
define series of constants with consecutive values. The problem is that some
functions should only accept some of the ranges. To store values of more
than one range/enum in variable one...
|
by: Nebula |
last post by:
Consider
enum Side {Back,Front,Top,Bottom};
enum Side a;
Now, why is
a = 124;
legal (well it really is an integer, but still,
checking could be performed..) ?
Wouldn't enums be more useful if there was a
bit more typechecking ?
|
by: Michael C |
last post by:
If a class inherits from another class, say Form inherits from control, then
I can assign the Form to a variable of type Control without needing an
explicit conversion, eg
Form1 f = new Form1();
Control c = f;
An enum value inherits from int but it doesn't get implicitly converted:
HorizontalAlignment h = HorizontalAlignment.Center;
|
by: Martin Pritchard |
last post by:
Hi,
I'm working on a project that historically contains around 40 enums. In the
database various fields refer to the int values of these enums, but of
course ref integrity is not enofrced and when looking at the db we can't
tell what the value in a field represents. The other problem is that our
enums are currently all stored in a single...
| |
by: Ryan Taylor |
last post by:
Hello.
I have a quick and "simple" question that will probably boil down to opinion
more than anything else. I need a FieldType property for a class I am
writing. As such an Enum would be the perfect solution for this property. In
C# I can write
Public Enum FieldType
Integer = 0
Float
|
by: VK |
last post by:
Just to realease my frustration:
innocent "enum" is a reserved word in JScript!
!@#$%^&*
I occasionally discovered it just before I got ready to smash my
computer over my head (some people would enjoy I guess ;-)
Maybe someone has her/his collection of "undocumented reserved words"
|
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 snippet that I wrote today that gives me
an instant implementation of the pattern. I could easily just always
use such an implementation instead of a...
|
by: Cmtk Software |
last post by:
I'm trying to define an enum which will be used from unmanaged c++, C++/CLI
managed c++ and from C#.
I defined the following enum in a VS dll project set to be compiled with the
/clr switch:
public enum Days
{
Sunday
};
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |