X#

1 program Added 2026-02-27T12:00:00Z Agent: claude-codeModel: claude-opus-4-6WebSearch: enabled Evidence Report issue View issues
Aliases: XSharp, X Sharp
Provenance: commit 371ed3e56a · authored 2026-02-27T14:29:30+01:00 · agent claude-code · model claude-opus-4-6

Sources mentioning this language

2 sources · pl_id: pl/xsharp
LLM (this repo) · 1Pldb

Related languages

XSharp (0.62)A# (0.29)F# (0.25)P# (0.25)C# (0.24)

LLM-contributed programs

LINQ Query Examples

Provenance: commit 371ed3e56a · authored 2026-02-27T14:29:30+01:00 · agent claude-code · model claude-opus-4-6 · WebSearch enabled
code.prg · license: Apache-2.0 · added: 2026-02-27T12:00:00Z
USING System.Collections.Generic
USING System.Linq
USING STATIC System.Console

FUNCTION Start AS VOID
	VAR oDev   := GetDevelopers()
	VAR oC     := GetCountries()
	VAR oAll   := 	FROM D 		 IN oDev  ;
					JOIN C 		 IN oC ON D:Country EQUALS C:Name   ;
					ORDERBY D:LastName  ;
					SELECT CLASS {D:Name, D:Country, C:Region}	// Anonymous class !

	// The type of oAll is WhereSelectEnumerableIterator<<>f__AnonymousType0<Developer,Country>>
	// We prefer the VAR keyword!

	VAR oGreek := 	FROM Developer IN oDev ;
					WHERE Developer:Country == "Greece" ;
					ORDERBY Developer:LastName DESCENDING ;
					SELECT Developer

	// The type of oGreek is IOrderedEnumerable<Developer>
	// We prefer the VAR keyword!

	VAR oCount := 	FROM Developer IN oDev ;
					GROUP Developer BY Developer:Country INTO NewGroup ;
					ORDERBY NewGroup:Key SELECT NewGroup

	// The type of oCount is IOrderedEnumerable<<IGrouping<string,Developer>>
	// We prefer the VAR keyword!

	WriteLine(e"X# does LINQ!\n")
	WriteLine(e"All X# developers (country+lastname order)\n")
	FOREACH VAR oDeveloper IN oAll
		WriteLine("{0} in {1}, {2}",oDeveloper:Name,oDeveloper:Country,oDeveloper:Region)
	NEXT

	WriteLine(e"\nGreek X# Developers (descending lastname)\n")
	FOREACH oDeveloper AS Developer IN oGreek
		WriteLine(oDeveloper:Name)
	NEXT

	WriteLine(e"\nDevelopers grouped per country\n")

	FOREACH VAR country IN oCount
		WriteLine(country:Key+" " +country:Count():ToString()+" developer(s)")
		FOREACH VAR oDeveloper IN country
			WriteLine("  " + oDeveloper:Name)
		NEXT
	NEXT
	WriteLine("Enter to continue")
	ReadLine()
	RETURN


FUNCTION GetDevelopers AS IList<Developer>
	// This function uses a collection initializer for the List of Developers
	// and Object initializers for the Developer Objects
	VAR oList := List<Developer>{} 	{ ;
										Developer{}{ FirstName  := "Chris", LastName := "Pyrgas", Country := "Greece"},;
										Developer{}{ FirstName  := "Robert", LastName := "van der Hulst", Country := "The Netherlands"},;
										Developer{}{ FirstName  := "Fabrice", LastName := "Foray", Country := "France"},;
										Developer{}{ FirstName  := "Nikos", LastName := "Kokkalis", Country := "Greece"} ;
									}
	RETURN oList

FUNCTION GetCountries AS IList<Country>
	// This function uses a collection initializer for the List of Counties
	// and Object initializers for the Country Objects
	VAR oList := List<Country>{}{ ;
									Country{} {Name := "Greece", 			Region := "South East Europe"},;
									Country{} {Name := "France", 			Region := "West Europe"},;
									Country{} {Name := "The Netherlands", 	Region := "North West Europe"} ;
								}
	RETURN oList
CLASS Developer
	PROPERTY Name 		AS STRING GET FirstName + " " + LastName
	PROPERTY FirstName 	AS STRING AUTO
	PROPERTY LastName 	AS STRING AUTO
	PROPERTY Country 	AS STRING AUTO
END CLASS

CLASS Country
	PROPERTY Name 		AS STRING AUTO
	PROPERTY Region 	AS STRING AUTO
END CLASS

Real programs from Software Heritage

No SWH evidence indexed yet for this language. (Either the SWH mining hasn't reached this language's extensions, or no matching files exist in the archive.)

Contribute — propose a file extension

Tell us where to find evidence about X# (mapped to pl/xsharp). A reference URL is required; at least one of extension or program code must be provided too. A maintainer reviews each submission via a draft PR before anything lands.
Optional: attach a program from that URL
If the reference URL points at a single source file you'd like to add as an example program, paste it below. The workflow will write it under languages/X#/programs/<sha>/. Keep under ~200 lines.
(or open the pre-filled issue directly)
← X vs. Y X(y) →