Explain C# code
Paste C#, LINQ queries and records included, and Vibe explains what each line returns and when the query actually runs.
Up to 1,500 characters (about 60 lines). Your code is sent to Unvibe and Google Gemini to write the explanation. Don't paste keys or passwords. Common key formats are refused.
Vibe16 lines selected
Press Explain it for the sample, or paste your own code first.
What this C# sample shows
- LINQ
Wherekeeps the batches whose minutes add up to at leastminimum, andOrderBysorts what is left by name. Withbeta(20 minutes),alpha(10 and 5) andtiny(2) and a minimum of 15, the result isalpha, beta:>=keepsalphaat exactly 15.- records
sealed record TaskBatch(string Name, List<int> Minutes)declares a class from its two values. C# writes theNameandMinutesproperties, value equality and aToStringthat lists each property, though for the list it prints only the type name, not the numbers.
Good to know
batch with { Name = name }returns a new record and leaves the old one alone: renamingalphatocopygives a second batch, and the original is still namedalpha.withcopies the reference to the list, not the list. Add 7 minutes to the copy'sMinutesand the original changes too: both now total 22.- Record equality compares each property with that property's own
Equals. Two batches namedathat share one list are equal, but with a new list of the same numbers they are not, because aList<int>is only equal to itself.
Watch out: LongBatches returns a query, not a list, and the query runs again every time you loop over it. Add a delta batch of 30 minutes to the source list after calling it and the same result now gives alpha, beta, delta, while a ToList() taken before still holds alpha, beta.
Explain C# code beside your editor
Unvibe is a free app for Mac and Windows. In the app there is no pasting: select code in any app and press Control+U (Ctrl+Alt+U on Windows).