When airspaces adjoin vertically, which airspace class does the shared flight level or altitude belong to? Airspaces have a lateral and vertical boundary, which results in airspaces adjoining other and thus having a shared vertical boundary. Which airspace class do these shared vertical boundaries belong to?

Example:
Dortmund's (EDLW) control zone is a class D from GND/SFC to 2500ft MSL, on top of this control zone is a TMA airspace class D from 2500ft MSL to 4500ft MSL thereafter class E from 4500ft MSL to FL100and above that we have class C airspace from FL100 to FL660.


(Image Source: www.skyvector.com - Map Data: skyvector, ARINC, OpenStreetMap)

If an aircraft wants to occupy 2500ft MSL, 4500ft MSL or FL100, which airspace class are they in?
According to ICAO Annex 11 - ATS (Air Traffic Services)PDF, the less restrictive airspace is in effect on shared boundaries:


  Note.— Where the ATS airspaces adjoin vertically, i.e. one above the other, flights at a common level would comply with
  requirements of, and be given services applicable to, the less restrictive class of airspace. In applying these criteria, Class B
  airspace is therefore considered less restrictive than Class A airspace; Class C airspace less restrictive than Class B
  airspace, etc. 


Unless national regulations in the country's AIP are in contradiction or the national AIP does not list any information on this, the ICAO regulation will apply.

In the above example, the altitudes or flight level would be considered:

2500ft MSL: Class D airspace
4500ft MSL: Class E airspace, since class E is less restrictive than class D
FL100: Class E airspace, since Class E is less restrictive than class C

Related questions:
What is the difference between “flight level” and “altitude”?
What is the difference between the airspace's classes (for non-pilots)?