Table of Contents

Class Weather

Namespace
SimpleWeather
Assembly
SimpleWeather.dll

Represents a single entry from the OpenWeather weather collection.

public class Weather
Inheritance
Weather
Inherited Members

Constructors

Weather()

Initializes a new, empty instance of the Weather class.

public Weather()

Properties

Description

Weather condition within the group

public string? Description { get; init; }

Property Value

string

Weather condition within the group

ID

Weather condition ID

public int ID { get; init; }

Property Value

int

Weather condition ID

Icon

Weather icon ID

public string? Icon { get; init; }

Property Value

string

Weather icon ID

Main

Group of weather parameters (Rain, Snow, Extreme etc.)

public string? Main { get; init; }

Property Value

string

Group of weather parameters (Rain, Snow, Extreme etc.)

Methods

FromJson(string?)

Creates this model from its OpenWeather JSON fragment.

public static Weather FromJson(string? json)

Parameters

json string

The JSON fragment, or null for an empty model.

Returns

Weather

The parsed weather model.

GetIconUrl(WeatherIconResolution)

Builds the CDN URL for this weather icon using the documented OpenWeather pattern.

public string? GetIconUrl(WeatherIconResolution resolution = WeatherIconResolution.DoubleScale)

Parameters

resolution WeatherIconResolution

Desired image scale (1x, 2x, or 4x).

Returns

string

The full icon URL or null when the icon code is unavailable.