private static unsafe bool ContainsApplication(IntPtr session, IntPtr profile, SOP.Profile profileDescriptor, ushort[] unicodeApplicationName, out SOP.Application application) { application = new SOP.Application(); if ((int)profileDescriptor.numOfApps == 0) { return(false); } SOP.Application[] applicationArray = new SOP.Application[(IntPtr)profileDescriptor.numOfApps]; uint appCount = profileDescriptor.numOfApps; fixed(SOP.Application *allApplications = applicationArray) { allApplications->version = 147464U; if (SOP.CheckForError(SOP.EnumApplications(session, profile, 0U, ref appCount, allApplications))) { return(false); } for (uint index = 0U; index < appCount; ++index) { // ISSUE: reference to a compiler-generated field if (SOP.UnicodeStringCompare(&((SOP.Application *)((IntPtr)allApplications + (IntPtr)((long)index * (long)sizeof(SOP.Application))))->appName.FixedElementField, unicodeApplicationName)) { application = *(SOP.Application *)((IntPtr)allApplications + (IntPtr)((long)index * (long)sizeof(SOP.Application))); return(true); } } } return(false); }