# HtmlCssNamespaceContext

Immutable stylesheet-scoped namespace bindings for CSS selectors.

Class 

`OfficeIMO.Html.Css`

**Namespace**

`OfficeIMO.Html.Css`

**Assembly**

`OfficeIMO.Html.Core`

**Source revision**

`56dd0d38e0b5` with working tree changes

**Source**

[HtmlCssSelectorAdvancedContracts.cs:11](https://github.com/EvotecIT/OfficeIMO/blob/56dd0d38e0b526611c1af001c026f8c72600880f/OfficeIMO.Html.Core/Css/HtmlCssSelectorAdvancedContracts.cs#L11)

**Modifiers**

sealed

Immutable stylesheet-scoped namespace bindings for CSS selectors.

## Inheritance

- object
- HtmlCssNamespaceContext

## Usage

Explore 2 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

### Returned or exposed by 2

- Method [HtmlCssNamespaceContext.FromStyleSheet](/api/html-core/officeimo-html-css-htmlcssnamespacecontext/#method-fromstylesheet-officeimo-html-css-htmlcssstylesheet)
- Property [HtmlCssSelectorOptions.Namespaces](/api/html-core/officeimo-html-css-htmlcssselectoroptions/#property-namespaces)

Filter members 

Show inherited

## Constructors

`public HtmlCssNamespaceContext(string? defaultNamespaceUri = null, IReadOnlyDictionary<string, string>? prefixes = null)` [#](#constructor-ctor-string-collections-generic-ireadonlydictionary-system-string-system-string)

[HtmlCssSelectorAdvancedContracts.cs:11](https://github.com/EvotecIT/OfficeIMO/blob/56dd0d38e0b526611c1af001c026f8c72600880f/OfficeIMO.Html.Core/Css/HtmlCssSelectorAdvancedContracts.cs#L11)

Creates namespace bindings. A null default leaves unprefixed type selectors namespace-unconstrained.

Parameters

**defaultNamespaceUri string? = null optional**

**prefixes System.Collections.Generic.IReadOnlyDictionary<string, string>? = null optional**

## Methods

`public static HtmlCssNamespaceContext FromStyleSheet(HtmlCssStyleSheet styleSheet)` [#](#method-fromstylesheet-officeimo-html-css-htmlcssstylesheet)

[HtmlCssSelectorAdvancedContracts.cs:33](https://github.com/EvotecIT/OfficeIMO/blob/56dd0d38e0b526611c1af001c026f8c72600880f/OfficeIMO.Html.Core/Css/HtmlCssSelectorAdvancedContracts.cs#L33)

Reads valid top-level @namespace declarations from an owned stylesheet.

Parameters

**styleSheet OfficeIMO.Html.Css.HtmlCssStyleSheet required**

Returns

`HtmlCssNamespaceContext`

`public bool TryGetNamespaceUri(string prefix, out string namespaceUri)` [#](#method-trygetnamespaceuri-string-string)

[HtmlCssSelectorAdvancedContracts.cs:29](https://github.com/EvotecIT/OfficeIMO/blob/56dd0d38e0b526611c1af001c026f8c72600880f/OfficeIMO.Html.Core/Css/HtmlCssSelectorAdvancedContracts.cs#L29)

Resolves a case-sensitive namespace prefix.

Parameters

**prefix string required**

**namespaceUri string required**

Returns

`bool`

## Inherited Methods

`public virtual bool Equals(object? obj)` [#](#method-equals-object)

Inherited from object

Parameters

**obj object? required**

Returns

`bool`

`public virtual int GetHashCode()` [#](#method-gethashcode)

Inherited from object

Returns

`int`

`public Type GetType()` [#](#method-gettype)

Inherited from object

Returns

`Type`

`public virtual string? ToString()` [#](#method-tostring)

Inherited from object

Returns

`string?`

## Properties

`public string? DefaultNamespaceUri { get; }` [#](#property-defaultnamespaceuri)

[HtmlCssSelectorAdvancedContracts.cs:25](https://github.com/EvotecIT/OfficeIMO/blob/56dd0d38e0b526611c1af001c026f8c72600880f/OfficeIMO.Html.Core/Css/HtmlCssSelectorAdvancedContracts.cs#L25)

The default namespace URI, or null when no default namespace is declared.

`public IReadOnlyDictionary<string, string> Prefixes { get; }` [#](#property-prefixes)

[HtmlCssSelectorAdvancedContracts.cs:27](https://github.com/EvotecIT/OfficeIMO/blob/56dd0d38e0b526611c1af001c026f8c72600880f/OfficeIMO.Html.Core/Css/HtmlCssSelectorAdvancedContracts.cs#L27)

Case-sensitive prefix bindings.

<!-- PowerForge markdown artifact sha256:E1C65351E6A261275E3D753C0E9769C934244BA0D245497C0A9344DB59981430 -->
