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.






































Generic Tadalafil 20mg price MensRxGuide – Cheap Cialis
Thanks , I’ve just been looking for information about this subject for ages and yours is the greatest I have discovered so far. But, what about the conclusion? Are you sure about the source?
Cialis without a doctor prescription п»їcialis generic – cialis for sale
I have been checking out many of your posts and i can claim pretty good stuff. I will definitely bookmark your site.
My brother suggested I might like this website. He was entirely right. This post truly made my day. You can not imagine simply how much time I had spent for this info! Thanks!
Good write-up, I am regular visitor of one’s website, maintain up the excellent operate, and It’s going to be a regular visitor for a lengthy time.
You have brought up a very good details, thanks for the post.
An impressive share! I’ve just forwarded this onto a co-worker who had been conducting a little research on this. And he actually ordered me lunch simply because I stumbled upon it for him… lol. So allow me to reword this…. Thanks for the meal!! But yeah, thanks for spending some time to talk about this matter here on your web site.
https://miroshina.com.ua/prozoryi-hermetyk-u-farakh-yak-dosyahty.html
Along with almost everything that appears to be developing throughout this particular subject matter, many of your viewpoints are generally relatively radical. Having said that, I appologize, but I do not subscribe to your entire suggestion, all be it stimulating none the less. It appears to everybody that your opinions are not totally rationalized and in simple fact you are your self not really completely confident of the argument. In any event I did take pleasure in looking at it.
Please let me know if you’re looking for a article writer for your weblog. You have some really good posts and I believe I would be a good asset. If you ever want to take some of the load off, I’d love to write some articles for your blog in exchange for a link back to mine. Please send me an e-mail if interested. Cheers!
15 seconds native trick
Good day! Would you mind if I share your blog with my facebook group? There’s a lot of people that I think would really appreciate your content. Please let me know. Cheers
https://www.google.mg/maps/d/edit?mid=14i7FLjDQyujYX0eb5iKDp8HcsvhkHNo
This really answered my downside, thanks!
I have recently started a website, the info you offer on this site has helped me tremendously. Thanks for all of your time & work.
Hi there! Do you use Twitter? I’d like to follow you if that would be okay. I’m absolutely enjoying your blog and look forward to new posts.
บาคาร่า
Cheap generic Viagra online buy viagra here – Cheap Sildenafil 100mg
Hmm it appears like your website ate my first comment (it was extremely long) so I guess I’ll just sum it up what I wrote and say, I’m thoroughly enjoying your blog. I too am an aspiring blog writer but I’m still new to the whole thing. Do you have any suggestions for rookie blog writers? I’d really appreciate it.
Hi, Neat post. There is a problem with your website in internet explorer, would test this… IE still is the market leader and a large portion of people will miss your excellent writing due to this problem.
trustworthy online pharmacy Victo Pharm no rx needed pharmacy
Hello to every body, it’s my first pay a quick visit of this blog; this blog contains remarkable and in fact good data in favor of readers.
online casino mit paysafe
victoza delivery liraglutide pharmacy liraglutide online
Hey there! I know this is kinda off topic but I’d figured I’d ask. Would you be interested in exchanging links or maybe guest authoring a blog post or vice-versa? My website addresses a lot of the same topics as yours and I believe we could greatly benefit from each other. If you happen to be interested feel free to shoot me an e-mail. I look forward to hearing from you! Great blog by the way!
casino en ligne retrait immediat
I’m not sure why but this website is loading incredibly slow for me. Is anyone else having this problem or is it a issue on my end? I’ll check back later on and see if the problem still exists.
บาคาร่า
Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point. You obviously know what youre talking about, why throw away your intelligence on just posting videos to your weblog when you could be giving us something enlightening to read?
Hey, you used to write magnificent, but the last several posts have been kinda boring?K I miss your tremendous writings. Past few posts are just a little bit out of track! come on!
Hi, Neat post. There is a problem with your website in internet explorer, would test this… IE still is the market leader and a large portion of people will miss your great writing due to this problem.
I’m extremely impressed together with your writing talents and also with the layout on your weblog. Is that this a paid subject matter or did you customize it yourself? Either way keep up the excellent high quality writing, it’s rare to see a great blog like this one nowadays..
Thank you for sharing with us, I conceive this website genuinely stands out :D.
Thanks for this rattling post, I am glad I detected this internet site on yahoo.
bariatric gelatin recipe
GELATIN TRICK
Just wish to say your article is as surprising. The clarity in your post is simply spectacular and i can assume you are an expert on this subject. Fine with your permission let me to grab your feed to keep up to date with forthcoming post. Thanks a million and please carry on the gratifying work.
บาคาร่า
Superb post but I was wanting to know if you could write a litte more on this subject? I’d be very grateful if you could elaborate a little bit further. Bless you!
viagra pills sexual xxx porn pills
I am always searching online for tips that can help me. Thanks!
Useful information. Fortunate me I discovered your web site by accident, and I’m surprised why this coincidence didn’t happened earlier! I bookmarked it.
meilleur casino en ligne
WOW just what I was searching for. Came here by searching for %keyword%
หวยออนไลน์
This information is priceless. When can I find out more?
在线购买大麻用于XXX成人色情视频
https://cialisvip.online/# Cialis Vip
An outstanding share! I’ve just forwarded this onto a colleague who has been conducting a little research on this. And he actually ordered me dinner due to the fact that I stumbled upon it for him… lol. So allow me to reword this…. Thank YOU for the meal!! But yeah, thanks for spending the time to discuss this issue here on your site.
viagra pills sexual xxx porn pills
Hello, of course this paragraph is truly good and I have learned lot of things from it about blogging. thanks.
شراء تادالافيل عبر الإنترنت لممارسة الجنس الشرجي xxx
Hi just wanted to give you a brief heads up and let you know a few of the pictures aren’t loading correctly. I’m not sure why but I think its a linking issue. I’ve tried it in two different web browsers and both show the same results.
adult xxx video porn site xxx sex video
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.
Thank you for another excellent article. The place else may just anyone get that type of info in such an ideal method of writing? I have a presentation subsequent week, and I’m on the search for such information.
viagra pills sexual xxx porn pills
hello there and thank you for your info – I have certainly picked up anything new from right here. I did however expertise some technical issues using this website, as I experienced to reload the website a lot of times previous to I could get it to load properly. I had been wondering if your hosting is OK? Not that I’m complaining, but slow loading instances times will sometimes affect your placement in google and can damage your high quality score if ads and marketing with Adwords. Well I’m adding this RSS to my email and can look out for a lot more of your respective exciting content. Make sure you update this again very soon..
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!
The following time I learn a blog, I hope that it doesnt disappoint me as much as this one. I mean, I know it was my choice to read, but I actually thought youd have something interesting to say. All I hear is a bunch of whining about one thing that you might fix for those who werent too busy searching for attention.
I am curious to find out what blog system you have been utilizing?
I’m experiencing some small security issues with my latest blog and I’d like to find something more safe.
Do you have any recommendations?
pharmacy fresh pharm pharmacy online
Fresh Pharm no prescription pharmacy paypal
Just wish to say your article is as astonishing. The clarity in your post is simply excellent and i could assume you are an expert on this subject. Fine with your permission allow me to grab your feed to keep up to date with forthcoming post. Thanks a million and please keep up the gratifying work.