get last 3 values of array

string col = "a.b.c.e.f.i.1.ff.bb"

how to get the last 3 values using linq or any method

result = "1.ff.bb";
eoswinAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Fernando SotoConnect With a Mentor RetiredCommented:
Hi eoswin;

Try this, it should give you what you need.

string col = "a.b.c.e.f.i.1.ff.bb";

var results = String.Join(".", col.Split(new Char[] {'.'}).Reverse().Take(3).Reverse().ToArray());

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.