/// <summary> /// Determines whether the workspaces are the same database. /// </summary> /// <param name="source">The workspace.</param> /// <param name="other">The other workspace.</param> /// <returns> /// Returns a <see cref="bool" /> representing <c>true</c> if the workspaces point to the same database; otherwise, /// <c>false</c>. /// </returns> public static bool IsEqual(this IWorkspace source, IWorkspace other) { if (source == null) { return(false); } if (other == null) { throw new ArgumentNullException("other"); } IMMWorkspaceManager manager = new MMWorkspaceManagerClass(); return(manager.IsSameDatabase(source, other)); }
/// <summary> /// Gets the workspace that satisifies the <paramref name="predicate" /> criteria. /// map. /// </summary> /// <param name="source">The source.</param> /// <param name="predicate">A function to test each element for a condition.</param> /// <returns> /// Returns a <see cref="IWorkspace" /> representing the workspace in the map that is being edited. /// </returns> /// <exception cref="ArgumentNullException">predicate</exception> public static IWorkspace GetWorkspace(this IMap source, Predicate <IWorkspace> predicate) { if (source == null) { return(null); } if (predicate == null) { throw new ArgumentNullException("predicate"); } IMMWorkspaceManagerMap manager = new MMWorkspaceManagerClass(); IEnumWorkspaceEx workspaces = manager.GetMapWorkspaces(source); return(workspaces.AsEnumerable().FirstOrDefault(workspace => predicate(workspace))); }