Problems 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’

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 interface

Private 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

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!

Thanks for the help! Yes I was following your documentation. Maybe I can finish up this application today. Thanks!