Celestial(Double, Double, DateTime, Double, EagerLoad) Constructor

Creates a Celestial object based on a location and specified date.

Definition

Namespace: CoordinateSharp
Assembly: CoordinateSharp (in CoordinateSharp.dll) Version: 2.21.1.1
XMLNS for XAML: Not mapped to an xmlns.
C#
public Celestial(
	double lat,
	double longi,
	DateTime geoDate,
	double offset,
	EagerLoad el
)

Parameters

lat  Double
Latitude
longi  Double
Longitude
geoDate  DateTime
DateTime (UTC)
offset  Double
UTC offset in hours
el  EagerLoad
EagerLoad

Remarks

Celestial information is normally populated within the Coordinate classes CelestialInfo property. However, you may choose to work directly within the Celestial class.

Example

The following example demonstrates how to get the sunset time at Seattle on 19-Mar-2019 directly from a Celestial object in local time populated only with solar cycle information.
C#
//Create EagerLoading object to load only solar cycle data for maximum efficiency.
EagerLoad el = new EagerLoad(EagerLoadType.Celestial);
el.Extensions = new EagerLoad_Extensions(EagerLoad_ExtensionsType.Solar_Cycle);

//Create a Celestial object the calculates from Seattle's signed lat/long on
//19-Mar-2019 (UTC) Date. Seattle is -7 UTC on this date.
Celestial cel = new Celestial(47.60357, -122.32945, new DateTime(2019, 3, 19), -7, el);

//Check if a sunset will occur on the specified day.
if(cel.SunSet.HasValue)
{
    Console.WriteLine(cel.SunSet.Value); //3/19/2019 7:20:56 PM
}

See Also