/// <summary> /// a factory method for creating the correct type of object label, depending on the /// class of the object /// </summary> public static ObjectLabel CreateObjectLabel(LcmCache cache, ICmObject obj, string displayNameProperty, string displayWs) { if (obj == null) { return(new NullObjectLabel(cache)); } var classId = obj.ClassID; return(cache.ClassIsOrInheritsFrom(classId, CmPossibilityTags.kClassId) ? new CmPossibilityLabel(cache, obj as ICmPossibility, displayNameProperty, displayWs) : (MoInflClassTags.kClassId == classId ? new MoInflClassLabel(cache, obj as IMoInflClass, displayNameProperty, displayWs) : new ObjectLabel(cache, obj, displayNameProperty, displayWs))); }