تبدیل نوع داده ای عناصر آرایه به نوعی دیگر با Array.ConvertAll در #C
سلام بر تمامی برنامه نویسان سی شارپ 😉 در این مطلب ، تبدیل نوع داده ای عناصر آرایه به نوعی دیگر با Array.ConvertAll در سی شارپ #C رو براتون آماده کردم. انشاالله که این کد براتون مفید باشه.
کدی که براتون آماده کردم عناصر یک آرایه رو از حالت رشته ای تبدیل به نوع double میکند.
این کار با استفاده از Array.ConvertAll و Array.ForEach انجام می شود.
خروجی پروژه به این صورت می باشد:
Converted to doubles: 75.3 25.999 105.25
تبدیل نوع داده ای عناصر آرایه به نوعی دیگر با Array.ConvertAll :
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
public class MainClass
{
public static void Main()
{
string[] strArray = new string[] { "75.3", "25.999", "105.25" };
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
public class MainClass
{
public static void Main()
{
string[] strArray = new string[] { "75.3", "25.999", "105.25" };