This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal class DataOperations | |
{ | |
public static IEnumerable<Customer> GetCustomerDetails() | |
{ | |
using IDbConnection connection = new SqlConnection(DataConnections.Instance.MainConnection); | |
var customerDictionary = new Dictionary<int, Customer>(); | |
var customers = connection.Query<Customer, Contact, Country, ContactType, Customer>( | |
SqlStatements.CustomerWithContacts(), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Numerics; | |
namespace Extensions; | |
public static class GenericINumberExtensions | |
{ | |
public static T[] Merge<T>(this T[] container, T[] T1) where T : INumber<T> | |
=> [.. container, .. T1]; | |
public static T[] Merge<T>(this T[] container, T[] T1, T[] T2) where T : INumber<T> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Diagnostics; | |
using NewStuffApp.Models; | |
namespace NewStuffApp.Classes; | |
/// <summary> | |
/// Provides a set of static methods for iterating over collections of various types | |
/// (e.g., strings, integers, and Person) and performing operations on them. | |
/// </summary> | |
internal class Params |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class Helpers | |
{ | |
/// <summary> | |
/// Retrieves the names of all entities that implement a specified interface type. | |
/// </summary> | |
/// <typeparam name="T"> | |
/// The interface type to search for. Must be a class type and an interface. | |
/// </typeparam> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var members = MemberOperations.MembersList(); | |
List<GroupedMember> groups = MemberOperations.GroupedMembers(members); | |
foreach (GroupedMember groupMember in groups) | |
{ | |
Console.WriteLine(groupMember); | |
foreach (Member member in groupMember.Lists) | |
{ | |
Console.WriteLine($"\t{member.Id,-3}{member.Active}"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USE tempdb | |
GO | |
-- Prepare the scene | |
CREATE TABLE #ChristmasScene | |
( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT t.name AS TableName, | |
p.rows AS [RowCount] | |
FROM sys.tables t | |
INNER JOIN sys.partitions p | |
ON t.object_id = p.object_id | |
WHERE p.index_id IN ( 0, 1 ) | |
ORDER BY p.rows DESC, | |
t.name; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* var pastDate = new Date('2014-10-01T02:30'); | |
* var message = fromNow(pastDate); | |
* //=> '2 days ago' | |
* | |
* @param {Date} Native JavaScript Date object | |
* @return {string} | |
*/ | |
function fromNow(date) { | |
var seconds = Math.floor((new Date() - date) / 1000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Text.RegularExpressions; | |
namespace Net9Features; | |
internal class Program | |
{ | |
static void Main(string[] args) | |
{ | |
const string sentence = "a test to see if"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public partial class Demo | |
{ | |
[OverloadResolutionPriority(2)] | |
public static void DisplayInvoice(string invoice ) | |
{ | |
Console.WriteLine($"invoice: {NextValue(invoice)}"); | |
} | |
[OverloadResolutionPriority(-1)] | |
public static void DisplayInvoice(string invoice, int count = 3) |
NewerOlder