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.

The Pink Salt Trick is a minimalist but effective morning routine: Just drink a glass of lukewarm water mixed with a pinch of Himalayan pink salt as soon as you wake up.
As I website possessor I believe the content material here is real superb, thanks for your efforts.
I have not checked in here for some time since I thought it was getting boring, but the last several posts are great quality so I guess I will add you back to my daily bloglist. You deserve it my friend 🙂
Super-Duper site! I am loving it!! Will be back later to read some more. I am taking your feeds also
Good web site! I truly love how it is simple on my eyes and the data are well written. I am wondering how I might be notified whenever a new post has been made. I have subscribed to your RSS which must do the trick! Have a nice day!
Absolutely indited articles, thankyou for selective information.
Valuable information. Lucky me I discovered your website by chance, and I am stunned why this coincidence didn’t came about earlier! I bookmarked it.
You actually make it appear so easy with your presentation however I in finding this matter to be really something that I believe I would by no means understand. It sort of feels too complicated and extremely extensive for me. I’m having a look ahead in your subsequent publish, I?¦ll try to get the grasp of it!
Hi, I think your site might be having browser compatibility issues. When I look at your website in Safari, it looks fine but when opening in Internet Explorer, it has some overlapping. I just wanted to give you a quick heads up! Other then that, fantastic blog!
This web site is really a walk-through for all of the info you wanted about this and didn’t know who to ask. Glimpse here, and you’ll definitely discover it.
I used to be recommended this web site by way of my cousin. I am no longer sure whether or not this post is written by means of him as nobody else understand such designated about my trouble. You are incredible! Thank you!
Hiya, I’m really glad I’ve found this info. Today bloggers publish only about gossips and net and this is really frustrating. A good site with exciting content, this is what I need. Thanks for keeping this website, I’ll be visiting it. Do you do newsletters? Can not find it.
This website is really a walk-through for all of the info you needed about this and didn’t know who to ask. Glimpse right here, and also you’ll positively discover it.
Oh my goodness! an incredible article dude. Thank you Nevertheless I am experiencing concern with ur rss . Don’t know why Unable to subscribe to it. Is there anyone getting similar rss problem? Anyone who is aware of kindly respond. Thnkx
Definitely consider that that you stated. Your favorite justification seemed to be on the net the simplest factor to take note of. I say to you, I certainly get annoyed whilst folks think about concerns that they just don’t know about. You controlled to hit the nail upon the highest and defined out the whole thing without having side-effects , folks can take a signal. Will likely be again to get more. Thanks
Interesting blog! Is your theme custom made or did you download it from somewhere? A theme like yours with a few simple tweeks would really make my blog jump out. Please let me know where you got your design. Thanks
Good post and straight to the point. I am not sure if this is in fact the best place to ask but do you people have any ideea where to employ some professional writers? Thanks in advance 🙂
It is really a nice and helpful piece of info. I¦m happy that you simply shared this useful info with us. Please keep us informed like this. Thanks for sharing.
fantastic points altogether, you just received a brand new reader. What would you recommend in regards to your put up that you made a few days in the past? Any positive?
You really make it appear really easy along with your presentation but I find this matter to be actually one thing that I believe I might never understand. It sort of feels too complicated and very wide for me. I am having a look forward to your next post, I will try to get the dangle of it!
Hello my family member! I want to say that this article is amazing, great written and come with approximately all vital infos. I would like to see more posts like this.
Thanks for another informative blog. Where else could I get that kind of information written in such an ideal way? I’ve a project that I am just now working on, and I have been on the look out for such info.
Very efficiently written article. It will be supportive to everyone who usess it, including yours truly :). Keep up the good work – can’r wait to read more posts.
Normally I don’t read post on blogs, but I wish to say that this write-up very forced me to try and do so! Your writing style has been amazed me. Thanks, very nice post.
It’s laborious to search out educated individuals on this topic, however you sound like you recognize what you’re talking about! Thanks
I’m just writing to make you know what a nice experience my girl went through viewing yuor web blog. She mastered a wide variety of pieces, which included what it is like to possess an incredible helping style to get certain people with ease thoroughly grasp certain problematic subject matter. You truly surpassed our own expected results. Many thanks for supplying such useful, trustworthy, educational as well as unique tips on that topic to Mary.
Hi, I think your site might be having browser compatibility issues. When I look at your website in Safari, it looks fine but when opening in Internet Explorer, it has some overlapping. I just wanted to give you a quick heads up! Other then that, fantastic blog!
Your place is valueble for me. Thanks!…
I am not certain the place you are getting your info, but good topic. I needs to spend some time studying much more or figuring out more. Thank you for great information I was searching for this info for my mission.
Thank you for sharing excellent informations. Your site is so cool. I am impressed by the details that you¦ve on this blog. It reveals how nicely you understand this subject. Bookmarked this website page, will come back for more articles. You, my pal, ROCK! I found just the info I already searched all over the place and just could not come across. What a great web-site.
It¦s in point of fact a nice and helpful piece of information. I am satisfied that you shared this helpful info with us. Please keep us informed like this. Thanks for sharing.
Hey! Someone in my Facebook group shared this website with us so I came to look it over. I’m definitely enjoying the information. I’m book-marking and will be tweeting this to my followers! Exceptional blog and excellent style and design.
Thank you for sharing with us, I conceive this website genuinely stands out : D.
I want to voice my affection for your kindness giving support to women who really need guidance on this particular situation. Your real dedication to getting the solution throughout had become amazingly productive and have always allowed guys and women much like me to attain their objectives. Your entire warm and helpful recommendations entails much a person like me and a whole lot more to my fellow workers. Many thanks; from everyone of us.
you have a great blog here! would you like to make some invite posts on my blog?
As soon as I discovered this internet site I went on reddit to share some of the love with them.
I’d have to examine with you here. Which is not one thing I usually do! I take pleasure in reading a post that may make folks think. Additionally, thanks for permitting me to comment!
The very heart of your writing whilst sounding reasonable in the beginning, did not really work very well with me personally after some time. Somewhere throughout the sentences you were able to make me a believer but only for a while. I still have a problem with your jumps in assumptions and you would do well to help fill in those gaps. In the event that you actually can accomplish that, I could undoubtedly end up being fascinated.
I am constantly browsing online for tips that can aid me. Thanks!
Nice post. I was checking constantly this blog and I am impressed! Extremely useful information specifically the last part 🙂 I care for such info a lot. I was seeking this certain information for a long time. Thank you and good luck.
Thankyou for all your efforts that you have put in this. very interesting information.
Hey! This post could not be written any better! Reading through this post reminds me of my previous room mate! He always kept chatting about this. I will forward this article to him. Pretty sure he will have a good read. Many thanks for sharing!
Having read this I thought it was very informative. I appreciate you taking the time and effort to put this article together. I once again find myself spending way to much time both reading and commenting. But so what, it was still worth it!
Someone essentially help to make seriously articles I would state. This is the first time I frequented your website page and thus far? I surprised with the research you made to create this particular publish amazing. Wonderful job!
Very interesting topic, regards for putting up.
Can I just say what a relief to find someone who actually knows what theyre talking about on the internet. You definitely know how to bring an issue to light and make it important. More people need to read this and understand this side of the story. I cant believe youre not more popular because you definitely have the gift.
hi!,I love your writing very a lot! proportion we be in contact extra about your post on AOL? I need an expert on this area to solve my problem. Maybe that’s you! Looking forward to look you.
The Pink Salt Trick is a minimalist but effective morning routine: Just drink a glass of lukewarm water mixed with a pinch of Himalayan pink salt as soo
Hey there, I think your website might be having browser compatibility issues. When I look at your blog site in Opera, it looks fine but when opening in Internet Explorer, it has some overlapping. I just wanted to give you a quick heads up! Other then that, superb blog!
The Pink Salt Trick is a minimalist but effective morning routine: Just drink a glass of lukewarm water mixed with a pinch of Himalayan pink salt as soo