Skip to Main Content

Net 4.0 Framework !full! -

// 2. Using Tuple Tuple<int, string, bool> person = Tuple.Create(1, "John Doe", true); Console.WriteLine($"ID: {person.Item1}, Name: {person.Item2}, Active: {person.Item3}");

// 3. Using ConcurrentCollection (thread-safe) var concurrentBag = new System.Collections.Concurrent.ConcurrentBag<int>(); concurrentBag.Add(10); concurrentBag.Add(20); net 4.0 framework

// 4. LINQ to Objects (fully supported) var numbers = new List<int> { 1, 2, 3, 4, 5 }; var evenNumbers = numbers.Where(n => n % 2 == 0).ToList(); Console.WriteLine($"Even numbers: {string.Join(",", evenNumbers)}"); LINQ to Objects (fully supported) var numbers =

using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Net40Example { class Program { static void Main(string[] args) { // 1. Using Task (TPL) - .NET 4.0 Task<string> task = Task.Factory.StartNew(() => { // Simulate work System.Threading.Thread.Sleep(1000); return "Hello from .NET 4.0 Task"; }); var evenNumbers = numbers.Where(n =&gt

// 5. Wait for task result Console.WriteLine(task.Result); } } }

Here’s a short, ready-to-use code piece for (C#) that demonstrates a few common tasks supported in that version:

Sign in with Email

or

Continue with GoogleContinue with FacebookContinue with Apple

By creating an account, you acknowledge that PBS may share your information with our member stations and our respective service providers, and that you have read and understand the Privacy Policy and Terms of Use.

Are you sure you want to remove null from My List?