Monday, April 19, 2021

Index in foreach loop

 1.  Index in foreach loop in c#


foreach ((var item, Int32 i) in data_banner.Select((value, i) => (value, i)))

{

    Console.WriteLine("I am at index" + i + " and I can find the value on val : " + item.Heading_Name);

}


 2.  Index in foreach loop in razor


@foreach ((var item, Int32 i) in data_banner.Select((value, i) => (value, i)))

{

    Console.WriteLine("I am at index" + i + " and I can find the value on val : " + item.Heading_Name);

}


No comments:

Post a Comment

Convert 1.25x speed spent hours convert into normal (1x) speed spent hours

If I run a video with 1.25x or 125% speed till 1 hour 26 minuts, then normal hours will be ?   1 hours 26 minuts convert into hours Total 60...