Convert this Code from VB to C#

  • Thread starter Thread starter New Devil
  • Start date Start date
N

New Devil

Hi all,
Can anybody help me to convert this code from VB to C#....i
got this code from msdn but i want to do this in C# ....
plz help if u can....thanx
the code is...
/***************************************/
'pick up the collection of Address objects
Dim gobjAddress As ITAddress
Dim objCollAddresses As ITCollection
Set objCollAddresses = gobjTapi.Addresses

'find address that supports the desired type, nSelectedType
bFound = False
For indexAddr = 1 To objCollAddresses.Count
Set objCrtAddress = objCollAddresses.Item(indexAddr)
Set objMediaSupport = objCrtAddress
Set objAddressCapabilities = objCrtAddress

If objMediaSupport.QueryMediaType( nSelectedType )
bFound = True
End If

Set objAddressCapabilities = Nothing
Set objMediaSupport = Nothing
Set objCrtAddress = Nothing

If bFound = True Then Exit For
Next indexAddr

Set gobjAddress = objcollAddresses.Item(indexAddr)

/***************************************/
 
It should look a bit like this (no guarantees given that I got it right)

ITAddress gobjAddress;
ITCollection objCollAddresses;
objCollAddresses = objTapi.Addresses

bFound = false;
for(indexAddr = 1; indexAddr < objCollAddresses.Count; indexAddr++)
{
objCrtAddress = objCollAddresses[indexAddr];
objMediaSupport = objCrtAddress;
objAddressCapabilities = objCrtAddress;

if(objMediaSupport.QueryMediaType(nSelectedType))
{
bFound = true;
}

objAddressCapabilities = null;
objMediaSupport = null;
objCrtAddress = null;

if(bFound == true)
{
break;
}
}

gobjAddress = objCollAddresses[indexAddr];
 
Back
Top