Search Results

Search found 1234 results on 50 pages for 'enum'.

Page 5/50 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • How to get C# Enum description from value?

    - by davekaro
    I have an enum with Description attributes like this: public enum MyEnum { Name1 = 1, [Description("Here is another")] HereIsAnother = 2, [Description("Last one")] LastOne = 3 } I found this bit of code for retrieving the description based on an Enum public static string GetEnumDescription(Enum value) { FieldInfo fi = value.GetType().GetField(value.ToString()); DescriptionAttribute[] attributes = (DescriptionAttribute[])fi.GetCustomAttributes( typeof(DescriptionAttribute), false); if (attributes != null && attributes.Length > 0) return attributes[0].Description; else return value.ToString(); } This allows me to write code like: var myEnumDescriptions = from MyEnum n in Enum.GetValues(typeof(MyEnum)) select new { ID = (int)n, Name = Enumerations.GetEnumDescription(n) }; What I want to do is if I know the enum value (e.g. 1) - how can I retrieve the description? In other words, how can I convert an integer into an "Enum value" to pass to my GetDescription method?

    Read the article

  • Forward declaring an enum in c++

    - by szevvy
    Hi guys, I'm trying to do something like the following: enum E; void Foo(E e); enum E {A, B, C}; which the compiler rejects. I've had a quick look on Google and the consensus seems to be "you can't do it", but I can't understand why. Can anyone explain? Many thanks. Clarification 2: I'm doing this as I have private methods in a class that take said enum, and I do not want the enum's values exposed - so, for example, I do not want anyone to know that E is defined as enum E { FUNCTIONALITY_NORMAL, FUNCTIONALITY_RESTRICTED, FUNCTIONALITY_FOR_PROJECT_X } as project X is not something I want my users to know about. So, I wanted to forward declare the enum so I could put the private methods in the header file, declare the enum internally in the cpp, and distribute the built library file and header to people. As for the compiler - it's GCC.

    Read the article

  • How do I access static variables in an enum class without a class instance?

    - by krick
    I have some code that processes fixed length data records. I've defined the record structures using java enums. I've boiled it down the the simplest example possible to illustrate the hoops that I currently have to jump through to get access to a static variable inside the enum. Is there a better way to get at this variable that I'm overlooking? If you compile and run the code, it just prints out "3". Note: the "code" tag doesn't seem to want to format this properly, but it should compile. class EnumTest { private interface RecordLayout { public int length(); } private enum RecordType1 implements RecordLayout { FIELD1 (2), FIELD2 (1), ; private int length; private RecordType1(int length) { this.length = length; } public int length() { return length; } public static int LEN = 3; } private static <E extends Enum<E> & RecordLayout> String parse(String data, Class<E> record) { // ugly hack to get at LEN... try { int len = record.getField("LEN").getInt(record); System.out.println(len); } catch (Exception e) { System.out.println(e); } String results = ""; for (E field: record.getEnumConstants()) { // do some stuff with the fields } return results; } public static void main(String args[]) { parse("ABC", RecordType1.class); } }

    Read the article

  • How thread-safe is enum in java?

    - by portoalet
    Hi, How thread-safe is enum in java? I am implementing a Singleton using enum (as per Bloch's Effective Java), should I worry at all about thread safety for my singleton enum? Is there a way to prove or disprove that it is thread safe? // Enum singleton - the preferred approach public enum Elvis { INSTANCE; public void leaveTheBuilding() { ... } } Thanks

    Read the article

  • Enumerate over an enum in C++

    - by jameszhao00
    In C++, Is it possible to enumerate over an enum (either runtime or compile time (preferred)) and call functions/generate code for each iteration? Sample use case: enum abc { start a, b, c, end } for each (__enum__member__ in abc) { function_call(__enum__member__); } Plausible duplicates: C++: Iterate through an enum Enum in C++ like Enum in Ada?

    Read the article

  • Is there a better way to create a generic convert string to enum method or enum extension?

    - by Kelsey
    I have the following methods in an enum helper class (I have simplified it for the purpose of the question): static class EnumHelper { public enum EnumType1 : int { Unknown = 0, Yes = 1, No = 2 } public enum EnumType2 : int { Unknown = 0, Dog = 1, Cat = 2, Bird = 3 } public enum EnumType3 : int { Unknown = 0, iPhone = 1, Andriod = 2, WindowsPhone7 = 3, Palm = 4 } public static EnumType1 ConvertToEnumType1(string value) { return (string.IsNullOrEmpty(value)) ? EnumType1.Unknown : (EnumType1)(Enum.Parse(typeof(EnumType1), value, true)); } public static EnumType2 ConvertToEnumType2(string value) { return (string.IsNullOrEmpty(value)) ? EnumType2.Unknown : (EnumType2)(Enum.Parse(typeof(EnumType2), value, true)); } public static EnumType3 ConvertToEnumType3(string value) { return (string.IsNullOrEmpty(value)) ? EnumType3.Unknown : (EnumType3)(Enum.Parse(typeof(EnumType3), value, true)); } } So the question here is, can I trim this down to an Enum extension method or maybe some type of single method that can handle any type. I have found some examples to do so with basic enums but the difference in my example is all the enums have the Unknown item that I need returned if the string is null or empty (if no match is found I want it to fail). Looking for something like the following maybe: EnumType1 value = EnumType1.Convert("Yes"); // or EnumType1 value = EnumHelper.Convert(EnumType1, "Yes"); One function to do it all... how to handle the Unknown element is the part that I am hung up on.

    Read the article

  • ASP.NET enum dropdownlist validation

    - by Arun Kumar
    I have got a enum public enum TypeDesc { [Description("Please Specify")] PleaseSpecify, Auckland, Wellington, [Description("Palmerston North")] PalmerstonNorth, Christchurch } I am binding this enum to drop down list using the following code on page_Load protected void Page_Load(object sender, EventArgs e) { if (TypeDropDownList.Items.Count == 0) { foreach (TypeDesc newPatient in EnumToDropDown.EnumToList<TypeDesc>()) { TypeDropDownList.Items.Add(EnumToDropDown.GetEnumDescription(newPatient)); } } } public static string GetEnumDescription(Enum value) { FieldInfo fi = value.GetType().GetField(value.ToString()); DescriptionAttribute[] attributes = (DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false); if (attributes != null && attributes.Length > 0) return attributes[0].Description; else return value.ToString(); } public static IEnumerable<T> EnumToList<T>() { Type enumType = typeof(T); // Can't use generic type constraints on value types, // so have to do check like this if (enumType.BaseType != typeof(Enum)) throw new ArgumentException("T must be of type System.Enum"); Array enumValArray = Enum.GetValues(enumType); List<T> enumValList = new List<T>(enumValArray.Length); foreach (int val in enumValArray) { enumValList.Add((T)Enum.Parse(enumType, val.ToString())); } return enumValList; } and my aspx page use the following code to validate <asp:DropDownList ID="TypeDropDownList" runat="server" > </asp:DropDownList> <asp:RequiredFieldValidator ID="TypeRequiredValidator" runat="server" ControlToValidate="TypeDropDownList" ErrorMessage="Please Select a City" Text="<img src='Styles/images/Exclamation.gif' />" ValidationGroup="city"></asp:RequiredFieldValidator> But my validation is accepting "Please Specify" as city name. I want to stop user to submit if the city is not selected.

    Read the article

  • How to refer to enum values inside nhibernate formula mapping specification?

    - by mark
    Dear ladies and sirs. I have two entities types: RunContainer parent entity type Run child entity type Run has a property Status, which is of type RunStatus, like so: public enum RunStatus { Created, Starting, // ... } public class Run { public int ContainerId { get; private set; } // ... public RunStatus Status { get; private set; } } RunContainer has a calculated property ActiveRunCount, like so: public class RunContainer { public int Id { get; private set; } // ... public int ActiveRunCount { get; private set; } } In the mapping for the RunContainer.ActiveRunCount property, I use the formula specification like so: <property name="ActiveRunCount" formula="(select count(r.Id) from Run r where r.ContainerId = Id and r.Status = 1)"/> My problem is that I refer to the RunStatus enum values in the formula by their respective numeric value, rather than the appropriate symbolic name. Can anyone tell me how can I use the symbolic name instead? Thanks.

    Read the article

  • Documenting using Sandcastle: Refering to enum value using <see>

    - by brickner
    I'm using Sandcastle 2.4.10520 and Sandcastle Help File Builder 1.8.0 to generate a .chm help file. In my documentation, I'm using <see> tags. If I try to refer an enum like <see cref="NumberStyles"/> it works perfectly. If I try to refer an enum value like <see cref="NumberStyles.AllowTrailingWhite"/> I get a link in the documentation file, but the link leads me to an MSDN Page not found I don't get any warnings - my xml documentation is correct. I've noticed that MSDN pages that refer to an enum value also have a Page not found link. For example: UInt64.Parse Method (String, NumberStyles, IFormatProvider) refers to NumberStyles.AllowHexSpecifier and this leads to another MSDN Page not found. Should I refer to the enum instead of the enum value? What should I do to refer an enum? Is it even possible?

    Read the article

  • Extending ENUM valus inherited from base object

    - by Tim
    Hi, If I defined a ENUM in a base object with serveral default values. When I inherit from the base object I want to add more options the the ENUM list which are specific to the inheriting object. For example my base could have a ENUM called Direction with values: None ALL Stop Start I create a new class call Compass which inherits the base class and what to add the following to the ENUM Direction. North South East West I create a new class call Navigation which inherits the base class and what to add the following to the ENUM Direction. Left Right So, In my inheriting class haow do I extend the ENUM. I am using VB.NET. Regards

    Read the article

  • Enum driving a Visual State change via the ViewModel

    - by Chris Skardon
    Exciting title eh? So, here’s the problem, I want to use my ViewModel to drive my Visual State, I’ve used the ‘DataStateBehavior’ before, but the trouble with it is that it only works for bool values, and the minute you jump to more than 2 Visual States, you’re kind of screwed. A quick search has shown up a couple of points of interest, first, the DataStateSwitchBehavior, which is part of the Expression Samples (on Codeplex), and also available via Pete Blois’ blog. The second interest is to use a DataTrigger with GoToStateAction (from the Silverlight forums). So, onwards… first let’s create a basic switch Visual State, so, a DataObj with one property: IsAce… public class DataObj : NotifyPropertyChanger { private bool _isAce; public bool IsAce { get { return _isAce; } set { _isAce = value; RaisePropertyChanged("IsAce"); } } } The ‘NotifyPropertyChanger’ is literally a base class with RaisePropertyChanged, implementing INotifyPropertyChanged. OK, so we then create a ViewModel: public class MainPageViewModel : NotifyPropertyChanger { private DataObj _dataObj; public MainPageViewModel() { DataObj = new DataObj {IsAce = true}; ChangeAcenessCommand = new RelayCommand(() => DataObj.IsAce = !DataObj.IsAce); } public ICommand ChangeAcenessCommand { get; private set; } public DataObj DataObj { get { return _dataObj; } set { _dataObj = value; RaisePropertyChanged("DataObj"); } } } Aaaand finally – hook it all up to the XAML, which is a very simple UI: A Rectangle, a TextBlock and a Button. The Button is hooked up to ChangeAcenessCommand, the TextBlock is bound to the ‘DataObj.IsAce’ property and the Rectangle has 2 visual states: IsAce and NotAce. To make the Rectangle change it’s visual state I’ve used a DataStateBehavior inside the Layout Root Grid: <i:Interaction.Behaviors> <ei:DataStateBehavior Binding="{Binding DataObj.IsAce}" Value="true" TrueState="IsAce" FalseState="NotAce"/> </i:Interaction.Behaviors> So now we have the button changing the ‘IsAce’ property and giving us the other visual state: Great! So – the next stage is to get that to work inside a DataTemplate… Which (thankfully) is easy money. All we do is add a ListBox to the View and an ObservableCollection to the ViewModel. Well – ok, a little bit more than that. Once we’ve got the ListBox with it’s ItemsSource property set, it’s time to add the DataTemplate itself. Again, this isn’t exactly taxing, and is purely going to be a Grid with a Textblock and a Rectangle (again, I’m nothing if not consistent). Though, to be a little jazzy I’ve swapped the rectangle to the other side (living the dream). So, all that’s left is to add some States to the template.. (Yes – you can do that), these can be the same names as the others, or indeed, something else, I have chosen to stick with the same names and take the extra confusion hit right on the nose. Once again, I add the DataStateBehavior to the root Grid element: <i:Interaction.Behaviors> <ei:DataStateBehavior Binding="{Binding IsAce}" Value="true" TrueState="IsAce" FalseState="NotAce"/> </i:Interaction.Behaviors> The key difference here is the ‘Binding’ attribute, where I’m now binding to the IsAce property directly, and boom! It’s all gravy!   So far, so good. We can use boolean values to change the visual states, and (crucially) it works in a DataTemplate, bingo! Now. Onwards to the Enum part of this (finally!). Obviously we can’t use the DataStateBehavior, it' only gives us true/false options. So, let’s give the GoToStateAction a go. Now, I warn you, things get a bit complex from here, instead of a bool with 2 values, I’m gonna max it out and bring in an Enum with 3 (count ‘em) 3 values: Red, Amber and Green (those of you with exceptionally sharp minds will be reminded of traffic lights). We’re gonna have a rectangle which also has 3 visual states – cunningly called ‘Red’, ‘Amber’ and ‘Green’. A new class called DataObj2: public class DataObj2 : NotifyPropertyChanger { private Status _statusValue; public DataObj2(Status status) { StatusValue = status; } public Status StatusValue { get { return _statusValue; } set { _statusValue = value; RaisePropertyChanged("StatusValue"); } } } Where ‘Status’ is my enum. Good times are here! Ok, so let’s get to the beefy stuff. So, we’ll start off in the same manner as the last time, we will have a single DataObj2 instance available to the Page and bind to that. Let’s add some Triggers (these are in the LayoutRoot again). <i:Interaction.Triggers> <ei:DataTrigger Binding="{Binding DataObject2.StatusValue}" Value="Amber"> <ei:GoToStateAction StateName="Amber" UseTransitions="False" /> </ei:DataTrigger> <ei:DataTrigger Binding="{Binding DataObject2.StatusValue}" Value="Green"> <ei:GoToStateAction StateName="Green" UseTransitions="False" /> </ei:DataTrigger> <ei:DataTrigger Binding="{Binding DataObject2.StatusValue}" Value="Red"> <ei:GoToStateAction StateName="Red" UseTransitions="False" /> </ei:DataTrigger> </i:Interaction.Triggers> So what we’re saying here is that when the DataObject2.StatusValue is equal to ‘Red’ then we’ll go to the ‘Red’ state. Same deal for Green and Amber (but you knew that already). Hook it all up and start teh project. Hmm. Just grey. Not what I wanted. Ok, let’s add a ‘ChangeStatusCommand’, hook that up to a button and give it a whirl: Right, so the DataTrigger isn’t picking up the data on load. On the plus side, changing the status is making the visual states change. So. We’ll cross the ‘Grey’ hurdle in a bit, what about doing the same in the DataTemplate? <Codey Codey/> Grey again, but if we press the button: (I should mention, pressing the button sets the StatusValue property on the DataObj2 being represented to the next colour). Right. Let’s look at this ‘Grey’ issue. First ‘fix’ (and I use the term ‘fix’ in a very loose way): The Dispatcher Fix This involves using the Dispatcher on the View to call something like ‘RefreshProperties’ on the ViewModel, which will in turn raise all the appropriate ‘PropertyChanged’ events on the data objects being represented. So, here goes, into turdcode-ville – population – me: First, add the ‘RefreshProperties’ method to the DataObj2: internal void RefreshProperties() { RaisePropertyChanged("StatusValue"); } (shudder) Now, add it to the hosting ViewModel: public void RefreshProperties() { DataObject2.RefreshProperties(); if (DataObjects != null && DataObjects.Count > 0) { foreach (DataObj2 dataObject in DataObjects) dataObject.RefreshProperties(); } } (double shudder) and now for the cream on the cake, adding the following line to the code behind of the View: Dispatcher.BeginInvoke(() => ((MoreVisualStatesViewModel)DataContext).RefreshProperties()); So, what does this *ahem* code give us: Awesome, it makes the single bound data object show the colour, but frankly ignores the DataTemplate items. This (by the way) is the same output you get from: Dispatcher.BeginInvoke(() => ((MoreVisualStatesViewModel)DataContext).ChangeStatusCommand.Execute(null)); So… Where does that leave me? What about adding a button to the Page to refresh the properties – maybe it’s a timer thing? Yes, that works. Right, what about using the Loaded event then eh? Loaded += (s, e) => ((MoreVisualStatesViewModel) DataContext).RefreshProperties(); Ahhh No. What about converting the DataTemplate into a UserControl? Anything is worth a shot.. Though – I still suspect I’m going to have to ‘RefreshProperties’ if I want the rectangles to update. Still. No. This DataTemplate DataTrigger binding is becoming a bit of a pain… I can’t add a ‘refresh’ button to the actual code base, it’s not exactly user friendly. I’m going to end this one now, and put some investigating into the use of the DataStateSwitchBehavior (all the ones I’ve found, well, all 2 of them are working in SL3, but not 4…)

    Read the article

  • Is it bad practice to use an enum that maps to some seed data in a Database?

    - by skb
    I have a table in my database called "OrderItemType" which has about 5 records for the different OrderItemTypes in my system. Each OrderItem contains an OrderItemType, and this gives me referential integrity. In my middletier code, I also have an enum which matches the values in this table so that I can have business logic for the different types. My dev manager says he hates it when people do this, and I am not exactly sure why. Is there a better practice I should be following?

    Read the article

  • Enum Naming Convention - Plural

    - by o.k.w
    I'm asking this question despite having read similar but not exactly what I want at http://stackoverflow.com/questions/495051/c-naming-convention-for-enum-and-matching-property I found I have a tendency to name enums in plural and then 'use' them as singular, example: public enum EntityTypes { Type1, Type2 } public class SomeClass { /* some codes */ public EntityTypes EntityType {get; set;} } Of course it works and this is my style, but can anyone find potential problem with such convention? I do have an "ugly" naming with the word "Status" though: public enum OrderStatuses { Pending, Fulfilled, Error, Blah, Blah } public class SomeClass { /* some codes */ public OrderStatuses OrderStatus {get; set;} } Additional Info: Maybe my question wasn't clear enough. I often have to think hard when naming the variables of the my defined enum types. I know the best practice, but it doesn't help to ease my job of naming those variables. I can't possibly expose all my enum properties (say "Status") as "MyStatus". My question: Can anyone find potential problem with my convention described above? It is NOT about best practice. Question rephrase: Well, I guess I should ask the question this way: Can someone come out a good generic way of naming the enum type such that when used, the naming of the enum 'instance' will be pretty straightforward?

    Read the article

  • Create Generic method constraining T to an Enum

    - by johnc
    I'm building a function to extend the Enum.Parse concept that allows a default value to be parsed in case that an Enum value is not found Is case insensitive So I wrote the following public static T GetEnumFromString<T>(string value, T defaultValue) where T : Enum { if (string.IsNullOrEmpty(value)) return defaultValue; foreach (T item in Enum.GetValues(typeof(T))) { if (item.ToString().ToLower().Equals(value.Trim().ToLower())) return item; } return defaultValue; } I am getting a Error Constraint cannot be special class 'System.Enum' Fair enough, but is there a workaround to allow a Generic Enum, or am I going to have to mimic the Parse function and pass a type as an attribute, which forces the ugly boxing requirement to your code. EDIT All suggestions below have been greatly appreciated, thanks Have settled on (I've left the loop to maintain case insensitivity - I am usng this when parsing XML) public static class EnumUtils { public static T ParseEnum<T>(string value, T defaultValue) where T : struct, IConvertible { if (!typeof(T).IsEnum) throw new ArgumentException("T must be an enumerated type"); if (string.IsNullOrEmpty(value)) return defaultValue; foreach (T item in Enum.GetValues(typeof(T))) { if (item.ToString().ToLower().Equals(value.Trim().ToLower())) return item; } return defaultValue; } }

    Read the article

  • C# naming convention for enum and matching property

    - by Serge - appTranslator
    Hi All, I often find myself implementing a class maintaining some kind of own status property as an enum: I have a Status enum and ONE Status property of Status type. How should I solve this name conflict? public class Car { public enum Status { Off, Starting, Moving }; Status status = Status.Off; public Status Status // <===== Won't compile ===== { get { return status; } set { status = value; DoSomething(); } } } If the Status enum were common to different types, I'd put it outside the class and the problem would be solved. But Status applies to Car only hence it doesn't make sense to declare the enum outside the class. What naming convention do you use in this case? NB: This question was partially debated in comments of an answer of this question. Since it wasn't the main question, it didn't get much visibility. EDIT: Filip Ekberg suggests an IMO excellent workaround for the specific case of 'Status'. Yet I'd be interesting to read about solutions where the name of the enum/property is different, as in Michael Prewecki's answer. EDIT2 (May 2010): My favorite solution is to pluralize the enum type name, as suggested by Chris S. According to MS guidelines, this should be used for flag enums only. But I've come to like it more and more. I now use it for regular enums as well.

    Read the article

  • C++ Declaring an enum within a class

    - by bporter
    In the following code snippet, the Color enum is declared within the Car class in order to limit the scope of the enum and to try not to "pollute" the global namespace. class Car { public: enum Color { RED, BLUE, WHITE }; void SetColor( Car::Color color ) { _color = color; } Car::Color GetColor() const { return _color; } private: Car::Color _color; }; (1) Is this a good way to limit the scope of the Color enum? Or, should I declare it outside of the Car class, but possibly within its own namespace or struct? I just came across this article today, which advocates the latter and discusses some nice points about enums: http://gamesfromwithin.com/stupid-c-tricks-2-better-enums. (2) In this example, when working within the class, is it best to code the enum as Car::Color, or would just Color suffice? (I assume the former is better, just in case there is another Color enum declared in the global namespace. That way, at least, we are explicit about the enum to we are referring.) Thanks in advance for any input on this.

    Read the article

  • Declaring an enum within a class

    - by bporter
    In the following code snippet, the Color enum is declared within the Car class in order to limit the scope of the enum and to try not to "pollute" the global namespace. class Car { public: enum Color { RED, BLUE, WHITE }; void SetColor( Car::Color color ) { _color = color; } Car::Color GetColor() const { return _color; } private: Car::Color _color; }; (1) Is this a good way to limit the scope of the Color enum? Or, should I declare it outside of the Car class, but possibly within its own namespace or struct? I just came across this article today, which advocates the latter and discusses some nice points about enums: http://gamesfromwithin.com/stupid-c-tricks-2-better-enums. (2) In this example, when working within the class, is it best to code the enum as Car::Color, or would just Color suffice? (I assume the former is better, just in case there is another Color enum declared in the global namespace. That way, at least, we are explicit about the enum to we are referring.) Thanks in advance for any input on this.

    Read the article

  • Enum.TryParse with Flags attribute

    - by Sunny
    I have written code to TryParse enum either by value or by its name as shown below. How can I extend this code to include parsing enums with Flags attribute? public static bool TryParse<T>(this T enum_type, object value, out T result) where T : struct { return enum_type.TryParse<T>(value, true, out result); } public static bool TryParse<T>(this T enum_type, object value, bool ignoreCase, out T result) where T : struct { result = default(T); var is_converted = false; var is_valid_value_for_conversion = new Func<T, object, bool, bool>[]{ (e, v, i) => e.GetType().IsEnum, (e, v, i) => value != null, (e, v, i) => Enum.GetNames(e.GetType()).Any(n => String.Compare(n, v.ToString(), i) == 0) || Enum.IsDefined(e.GetType(), v) }; if(is_valid_value_for_conversion.All(rule => rule(enum_type, value, ignoreCase))){ result = (T)Enum.Parse(typeof(T), value.ToString(), ignoreCase); is_converted = true; } return is_converted; } Currently this code works for the following enums: enum SomeEnum{ A, B, C } // can parse either by 'A' or 'a' enum SomeEnum1 : int { A = 1, B = 2, C = 3 } // can parse either by 'A' or 'a' or 1 or "1" Does not work for: [Flags] enum SomeEnum2 { A = 1, B = 2, C = 4 } // can parse either by 'A' or 'a' // cannot parse for A|B Thanks!

    Read the article

  • why Cannot invoke super constructor from enum constructor ?

    - by hilal
    public enum A { A(1); private A(int i){ } private A(){ super(); // compile - error // Cannot invoke super constructor from enum constructor A() } } and here is the hierarchy of enum A extends from abstract java.lang.Enum extends java.lang.Object Class c = Class.forName("/*path*/.A"); System.out.println(c.getSuperclass().getName()); System.out.println(Modifier.toString(c.getSuperclass().getModifiers()).contains("abstract")); System.out.println(c.getSuperclass().getSuperclass().getName());

    Read the article

  • C# cross class enum visibility - Possible?

    - by 537mfb
    so i have a class ClassA that contains an enum MyEnum, and a class ClassB that references that class (different Projects) and so in ClassB i have a using ClassA; clause and i can access that enum using something like MyEnum value = MyEnum.EnumValue; Now on a third project i have my Windows form and it has a clause like using ClassB; Now what can i add in ClassB to acess that enum on my windows Form? Is it even Possible? i would like to avoid having to add ClassA to my form just to access an enum. The idea is that ClassB is sort of a manager between my form and the functionality in ClassA - but i would like to get access to that enum as it makes a lot of tasks easier

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >