Forum Discussion
David_Los_23059
Nimbostratus
Jul 26, 2006Problems with an If Statement
Hello,
I have been working on a C console application and I am having problems with an if statement that is trying to check the LocalLB.EnabledStatus.
The line of code that I am using looks like
if (new_obj_members[j][k].object_status.enabled_status == PoolMember.LocalLBEnabledStatus.ENABLED_STATUS_ENABLED)
//Just using this to test
Console.Write("this is enabled");
This is giving me the error: 'PoolMember.LocalLBPoolMember' does not contain a definition for 'LocalLBEnabledStatus'
I also tried with this
if (new_obj_members[j][k].object_status.enabled_status == LocalLBEnabledStatus.ENABLED_STATUS_ENABLED)
//Just using this to test
Console.Write("this is enabled");
This is giving the error: Operator '==' cannot be applied to operands of type 'PoolMember.LocalLBEnabledStatus' and 'Pool.LocalLBEnabledStatus'
3 Replies
- Can you post the type of your new_obj_members variable? Is this the return from LocalLB::PoolMember::get_object_status()?
Some common problems I've seen (and have been guilty of) is calling your local variables the same as the interfacePrivate LocalLBPoolMember PoolMember = new LocalLBPoolMember();
If you imported the PoolMember WSDL with the namespace "PoolMember" this can cause some conflicts. I've changed my ways and made the member variables different:private LocalLBPoolMember m_poolMember = new LocalLBPoolMember()
Not sure if this will help in your situation or not as I don't know how you've written your code. In the future, it really helps if you send the relevant sections of code around the issue.
-Joe - David_Los_23059
Nimbostratus
Sorry about not posting the entire code. I didnt know how much I should post on here. Below is what I currently have in that area of the code.private LocalLBPool Pool = new LocalLBPool(); private LocalLBPoolMember PoolMember = new LocalLBPoolMember();void getPoolInfo(string[] pool_list) { //Get the Current Active Member Count long[] cur_active_member_list = Pool.get_active_member_count(pool_list); //Gets the Member Objects - Status and Enabled State LocalLBPoolMemberMemberObjectStatus[][] new_obj_members = PoolMember.get_object_status(pool_list); // Output the Active Member Count for (int i = 0; i < pool_list.Length; i++) { Console.WriteLine("Current Active Members: " + cur_active_member_list); } //Output the IP and Enabled State for (int j = 0; j < new_obj_members.GetLength(0); j++) { for (int k = 0; k < new_obj_members[j].GetLength(0); k++) { Console.WriteLine("IP Number: " + new_obj_members[j][k].member.address + " " + new_obj_members[j][k].object_status.availability_status); Console.Write("this is enabled"); } }
The attached file is what I have been playing around with. I have been doing a testing file and then I implement the finished code into the actual program.
Thanks for the help! - David_Los_23059
Nimbostratus
Thanks for the help! Yes I was following your documentation. Maybe I can finish up this application today. Thanks!
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
