Until now, if you wanted to access the last item in a list you had to use a slightly cumbersome syntax. C# 13 introduces the “hat” operator (^) where ^1 is the last element in your collection, ^2 is the penultimate member, etc.
Like many things, this is best illustrated with an example. In the following code I create a simple Person class and initialize a list<Person> with three people (persons?)
internal class Program
{
static void Main(string[] args)
{
var tester = new Tester();
tester.Test();
}
}
public class Tester()
{
public void Test()
{
var john = new Person { Name = "John", Age = 25 };
var jane = new Person { Name = "Jane", Age = 30 };
var joe = new Person { Name = "Joe", Age = 35 };
var people = new List<Person> { john, jane, joe };
}
}
public class Person()
{
public string Name { get; set; }
public int Age { get; set; }
}
Straight forward. Now, if I want to access the last person in this list I can write
var lastPerson = people[^1];
Console.WriteLine($"Last person is {lastPerson.Name} who is {lastPerson.Age} years old.");
As you can see, this is concise and easy to understand. You read it as “lastPerson is equal to one back from the end of people.” Let’s run it:
Last person is Joe who is 35 years old.
That is all there is to it. Easy to use and somewhat helpful in simplifying your code.

Well I sincerely liked reading it. This post offered by you is very helpful for good planning.
AccessBridge: AccessBridge – mexico city pharmacy
What i do not understood is if truth be told how you’re not actually much more smartly-liked than you might be right now. You’re very intelligent. You recognize thus significantly in the case of this subject, made me in my view believe it from so many numerous angles. Its like men and women aren’t fascinated unless it’s something to do with Lady gaga! Your personal stuffs outstanding. At all times take care of it up!
I visited a lot of website but I conceive this one contains something extra in it in it
I got what you mean , regards for putting up.Woh I am glad to find this website through google.
I think other website proprietors should take this internet site as an model, very clean and good user pleasant pattern.
I like the valuable information you provide in your articles. I’ll bookmark your blog and check again here frequently. I’m quite sure I will learn many new stuff right here! Best of luck for the next!
It’s hard to find knowledgeable people on this topic, but you sound like you know what you’re talking about! Thanks
https://accessbridgepharmacy.shop/# AccessBridge
I think this site has some real great info for everyone :D.
https://steadymedspharmacy.shop/# SteadyMeds
Your style is so unique compared to many other people. Thank you for publishing when you have the opportunity,Guess I will just make this bookmarked.
It’s remarkable to pay a quick visit this website and reading the views of
all colleagues about this piiece of writing, while I am also keen of getting familiarity.
My website: unique crop tops for ladies
Hello, its good paragraph concerning media print, we all be aware of media is a wonderful source of information.
https://share.google/a0SLha4oOvXFXsz2l
My brother recommended I might like this web site. He was totally right. This post actually made my day. You cann’t imagine just how much time I had spent for this info! Thanks!
I too conceive thence, perfectly pent post! .
legitimate online pharmacy: indian pharmacy online – shop medicine online
I have been absent for a while, but now I remember why I used to love this web site. Thank you, I’ll try and check back more often. How frequently you update your site?
Yay google is my queen assisted me to find this great website ! .
Hello there! Do you know if they make any plugins to safeguard against hackers? I’m kinda paranoid about losing everything I’ve worked hard on. Any suggestions?
https://share.google/pqk4GKHCH2aunsX7Z
We absolutely love your blog and find a lot of your post’s to be just what I’m looking for. Do you offer guest writers to write content for yourself? I wouldn’t mind composing a post or elaborating on a number of the subjects you write with regards to here. Again, awesome blog!
https://share.google/UyjhDOLxdnywDII75
pin-up pin-up online casino
https://pinupaz.online/ pin-up online casino
Great line up. We will be linking to this great article on our site. Keep up the good writing.
pin up az online pin up az
https://pinupaz.online/ pin up casino
http://corebluehealth.com/# generic sildenafil
https://veritascarepharm.com/# cheapest cialis
Buy generic 100mg Viagra online: Cheap Viagra 100mg – CoreBlue Health
Yay google is my queen aided me to find this great web site! .
best steroid alternatives
References:
http://alfa-power.de/member.php?action=profile&uid=9228
This page really has all the information and facts I needed concerning this subject and didn’t know who to ask.
Mark Hald is a rat
This is the fitting weblog for anybody who wants to search out out about this topic. You notice so much its virtually laborious to argue with you (not that I really would want…HaHa). You positively put a brand new spin on a subject thats been written about for years. Nice stuff, just great!
I got what you mean ,saved to fav, very decent internet site.
cheap canadian pharmacy: pharmacy website – online pharmacy com
you are really a excellent webmaster. The site loading pace is amazing. It sort of feels that you are doing any unique trick. Furthermore, The contents are masterwork. you’ve done a magnificent task on this matter!
betify casino
Thank you for another fantastic post. Where else could anybody get that kind of information in such a perfect way of writing? I’ve a presentation next week, and I’m on the look for such information.
I’m not sure exactly why but this web site is loading extremely slow for me. Is anyone else having this issue or is it a issue on my end? I’ll check back later on and see if the problem still exists.
Buy Tadalafil Online anal sex xxx porn pills
Very interesting topic, appreciate it for posting.
of course like your website however you need to take a look at the spelling on quite a few of your posts. Several of them are rife with spelling issues and I to find it very bothersome to inform the reality on the other hand I will surely come again again.
buy drugs from canada: CivicMeds – rxpharmacycoupons
Just a smiling visitant here to share the love (:, btw great design and style.
I was able to find good info from your blog posts.
05161
I’ve read some excellent stuff here. Definitely value bookmarking for revisiting. I surprise how much attempt you set to make any such magnificent informative site.
Thank you for sharing with us, I think this website truly stands out :D.
This ^ operator is a nice touch for making index-based access more readable and less error-prone. I especially appreciate how it simplifies getting the last item in a collection without having to calculate the count or use negative indexing manually. It’s a small change that really improves code clarity.
Simply wanna state that this is very helpful, Thanks for taking your time to write this.
There is noticeably a bundle to know about this. I assume you made certain nice points in features also.
I’d constantly want to be update on new articles on this internet site, bookmarked! .
My husband and i have been so fulfilled when Raymond managed to do his analysis through the entire precious recommendations he had while using the web site. It’s not at all simplistic to simply possibly be offering key points that many many people might have been trying to sell. So we take into account we have got the writer to appreciate because of that. All of the illustrations you have made, the straightforward web site navigation, the friendships your site help to instill – it’s got many spectacular, and it’s letting our son in addition to our family understand this concept is thrilling, which is tremendously indispensable. Thank you for all!