Friday, September 15, 2023

C#


 



C# 2nd highest number print from array

static void Main() { // Create an array of integers int[] numbers = { 10, 5, 17, 8, 25, 3, 12 };

        // Find the maximum number using LINQ's Max method int maxNumber = numbers.Max(); // Sort the array in descending order Array.Sort(numbers, (a, b) => b.CompareTo(a)); // Check if there are at least two elements in the array if (numbers.Length >= 2) { // Print the second highest number Console.WriteLine("The second highest number is: " + numbers[1]); } else { Console.WriteLine("The array does not have a second highest number."); } }

------------------

using System; using System.Threading; using System.Threading.Tasks; class Program { static void Main() { // Create an array of integers int[] numbers = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; // Create a parallel loop using Parallel.ForEach Parallel.ForEach(numbers, number => { // Simulate some processing Thread.Sleep(100); // Print the square of the number Console.WriteLine($"{number} squared is {number * number}"); }); Console.WriteLine("Parallel processing is complete."); } }

Friday, August 25, 2023

Version


C# 10.0

Net Framework 4.7

Microsoft Visual Studio 2015, 2017, 2019, 2022 

VersionCLRRelease
date
Support
ended
Visual Studio
3.52.02007-11-19[18]Visual Studio 2008

4.742017-04-05[28]Same as
parent OS[14]
Visual Studio 2017

Net Core 3.1

 

Microsoft SQL Server

VersionRelease
Date

Release name
10.0November 6, 2008
SQL Server 2008
13.0June 1, 2016
SQL Server 2016
14.0September 29, 2017
SQL Server 2017
15.0November 4, 2019
SQL Server 2019
16.0November 16, 2022
SQL Server 2022

DataPath Ltd.

Outsourcing and Offshoring Consulting

Thursday, March 9, 2023

solid

 SOLID / solid

1. 𝗦𝗶𝗻𝗴𝗹𝗲 𝗥𝗲𝘀𝗽𝗼𝗻𝘀𝗶𝗯𝗶𝗹𝗶𝘁𝘆 𝗣𝗿𝗶𝗻𝗰𝗶𝗽𝗹𝗲 (𝗦𝗥𝗣)

A class should have only one reason to change. In other words, a class should have a single, well-defined responsibility. That class should entirely encapsulate responsibility.

2. 𝗢𝗽𝗲𝗻/𝗖𝗹𝗼𝘀𝗲𝗱 𝗣𝗿𝗶𝗻𝗰𝗶𝗽𝗹𝗲 (𝗢𝗖𝗣)

Software entities (classes, functions, etc.) should be open for extension but closed for modification. You should be able to add new functionality to a class without changing its existing code, but you should not need to modify the class itself to do so.

3. 𝗟𝗶𝘀𝗸𝗼𝘃 𝗦𝘂𝗯𝘀𝘁𝗶𝘁𝘂𝘁𝗶𝗼𝗻 𝗣𝗿𝗶𝗻𝗰𝗶𝗽𝗹𝗲 (𝗟𝗦𝗣)

Subtypes must be substitutable for their base types. In other words, if a class is derived from another class, you should be able to use the derived class in the same way as the base class without any issues.

4. 𝗜𝗻𝘁𝗲𝗿𝗳𝗮𝗰𝗲 𝗦𝗲𝗴𝗿𝗲𝗴𝗮𝘁𝗶𝗼𝗻 𝗣𝗿𝗶𝗻𝗰𝗶𝗽𝗹𝗲 (𝗜𝗦𝗣)

Clients should not depend on interfaces they do not use. This means you should design your interfaces as specific and focused as possible.

5. 𝗗𝗲𝗽𝗲𝗻𝗱𝗲𝗻𝗰𝘆 𝗜𝗻𝘃𝗲𝗿𝘀𝗶𝗼𝗻 𝗣𝗿𝗶𝗻𝗰𝗶𝗽𝗹𝗲 (𝗗𝗜𝗣)

High-level modules should not depend on low-level modules. Both should depend on abstractions. Design your software so high-level modules depend on abstractions rather than concrete implementations.





















Denton

Denton  House Address 2113 Paxton Way, Denton, TX 76209  WiFi Info Network: TE Paxton Password: Paxtonrental222 Peterbilt Motors Corporate H...