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.

I am glad to be a visitor of this stark web site! , appreciate it for this rare information! .
Great post. I am facing a couple of these problems.
It’s really a cool and helpful piece of info. I’m glad that you shared this helpful info with us. Please keep us up to date like this. Thanks for sharing.
great points altogether, you just gained a brand new reader. What would you suggest about your post that you made a few days ago? Any positive?
Can I simply say what a aid to seek out somebody who truly knows what theyre speaking about on the internet. You positively know learn how to deliver an issue to mild and make it important. Extra people need to learn this and perceive this side of the story. I cant believe youre no more fashionable since you positively have the gift.
Thanks for every other wonderful article. Where else could anyone get that kind of info in such a perfect means of writing? I have a presentation subsequent week, and I am at the look for such info.
Hello my friend! I want to say that this post is awesome, nice written and include approximately all vital infos. I¦d like to peer extra posts like this .
Youre so cool! I dont suppose Ive read anything like this before. So nice to find any individual with some unique thoughts on this subject. realy thanks for beginning this up. this web site is one thing that is needed on the internet, somebody with a little originality. helpful job for bringing something new to the web!
The Ultimate Electric Toothbrush for a Superior Clean Experience the future of oral care with imask. This premium electric toothbrush combines powerful 3D sonic technology with intelligent features for a flawless clean. Its advanced magnetic motor generates high-frequency vibrations that effectively remove plaque, while the smart pressure sensor protects your gums.
I dugg some of you post as I cerebrated they were very beneficial invaluable
Nice post. I be taught one thing more challenging on completely different blogs everyday. It would all the time be stimulating to learn content from different writers and follow a little one thing from their store. I’d favor to make use of some with the content material on my blog whether you don’t mind. Natually I’ll give you a link on your net blog. Thanks for sharing.
I have read several good stuff here. Certainly value bookmarking for revisiting. I wonder how a lot attempt you put to make the sort of excellent informative site.
Hi there very nice website!! Guy .. Beautiful .. Superb .. I will bookmark your website and take the feeds additionally…I’m glad to find so many useful information right here within the publish, we’d like work out extra strategies in this regard, thank you for sharing.
Very interesting subject, regards for putting up.
We absolutely love your blog and find almost all of your post’s to be exactly I’m looking for. Would you offer guest writers to write content in your case? I wouldn’t mind producing a post or elaborating on a lot of the subjects you write related to here. Again, awesome website!
Hello my family member! I wish to say that this article is awesome, nice written and come with almost all important infos. I’d like to peer extra posts like this.
Dead pent written content, thank you for information. “The last time I saw him he was walking down Lover’s Lane holding his own hand.” by Fred Allen.
There is obviously a bunch to realize about this. I suppose you made some good points in features also.
This is a topic close to my heart cheers, where are your contact details though?
There is visibly a lot to identify about this. I assume you made various nice points in features also.
I believe this web site holds very wonderful written subject matter articles.
It’s actually a great and helpful piece of information. I’m happy that you simply shared this helpful information with us. Please stay us up to date like this. Thanks for sharing.
Keep up the excellent work, I read few content on this web site and I conceive that your website is very interesting and holds bands of superb info .
You actually make it seem so easy with your presentation but I find this matter to be actually something that I think I would never understand. It seems too complicated and very broad for me. I am looking forward for your next post, I will try to get the hang of it!
Your place is valueble for me. Thanks!…
I really appreciate this post. I¦ve been looking all over for this! Thank goodness I found it on Bing. You’ve made my day! Thank you again
Very interesting subject , regards for posting.
Hi there! Someone in my Myspace group shared this website with us so I came to check it out. I’m definitely loving the information. I’m book-marking and will be tweeting this to my followers! Great blog and excellent style and design.
Its fantastic as your other posts : D, thanks for putting up.
Thank you for the auspicious writeup. It in fact was once a amusement account it. Glance complicated to more delivered agreeable from you! However, how could we keep in touch?
You completed a few good points there. I did a search on the subject and found a good number of people will go along with with your blog.
Very nice design and good content, practically nothing else we need : D.
Very interesting information!Perfect just what I was looking for! “It’s the Brady Act taking manpower and crime-fighting capability off the streets.” by Dennis Martin.
I’m not that much of a internet reader to be honest but your sites really nice, keep it up! I’ll go ahead and bookmark your website to come back later on. All the best
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!
Great post. I am facing a couple of these problems.
Great – I should certainly pronounce, impressed with your web site. I had no trouble navigating through all tabs and related info ended up being truly simple to do to access. I recently found what I hoped for before you know it at all. Reasonably unusual. Is likely to appreciate it for those who add forums or anything, web site theme . a tones way for your client to communicate. Nice task.
Hello. remarkable job. I did not imagine this. This is a excellent story. Thanks!
Regards for this post, I am a big fan of this site would like to go along updated.
Do you have a spam issue on this site; I also am a blogger, and I was wanting to know your situation; many of us have created some nice practices and we are looking to swap techniques with others, be sure to shoot me an e-mail if interested.
Perfect piece of work you have done, this site is really cool with superb info .
Dead composed articles, regards for selective information.
Good V I should certainly pronounce, impressed with your site. I had no trouble navigating through all the tabs and related information ended up being truly easy to do to access. I recently found what I hoped for before you know it at all. Reasonably unusual. Is likely to appreciate it for those who add forums or something, website theme . a tones way for your customer to communicate. Nice task..
Great – I should certainly pronounce, impressed with your web site. I had no trouble navigating through all tabs as well as related information ended up being truly simple to do to access. I recently found what I hoped for before you know it in the least. Quite unusual. Is likely to appreciate it for those who add forums or something, website theme . a tones way for your client to communicate. Excellent task.
Nice post. I was checking constantly this blog and I am impressed! Very useful information particularly the last part 🙂 I care for such info a lot. I was looking for this certain information for a very long time. Thank you and best of luck.
Have you ever thought about including a little bit more than just your articles? I mean, what you say is important and everything. Nevertheless think about if you added some great graphics or videos to give your posts more, “pop”! Your content is excellent but with pics and videos, this blog could undeniably be one of the best in its niche. Good blog!
I like the valuable information you provide in your articles. I’ll bookmark your weblog and check again here regularly. I am quite certain I will learn lots of new stuff right here! Good luck for the next!
Hello. excellent job. I did not imagine this. This is a excellent story. Thanks!
I like what you guys are up too. Such smart work and reporting! Keep up the superb works guys I have incorporated you guys to my blogroll. I think it will improve the value of my web site 🙂
Hi , I do believe this is an excellent blog. I stumbled upon it on Yahoo , i will come back once again. Money and freedom is the best way to change, may you be rich and help other people.