How can I check the value of a Fluid Contact type?
I want to retrieve data from a fluid contact set only if the contact is from a certain type.
This is what开发者_如何学运维 i wrote:ContactSet fcset = FcSetGridBox.Tag as ContactSet;
foreach (Contact fc in fcset.Contacts)
{
if (fc.ContactType.Equals(oilwater))
{
args.OilZoneContV=fc.GetZValue();
}
else
if (fc.ContactType = "oilgas"')
{
args.GasZoneContV = fc.GetZValue();
}
}
But I don't know what to compare the ContactType to.
The Ocean manual mention the contact type enumeration but i cant use them as stringI just found the answer: I need to test against the actual enumeration values.
if (fc.ContactType.Equals(ContactType.OilGas))
{ ... }
And Enumerations can safely be compared with the == operator as well.
精彩评论