This file contains hidden or 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
input[type="text"], | |
input[type="email"], | |
input[type="password"] { | |
all: unset; | |
box-sizing: border-box; | |
display: block; | |
width: 100%; | |
max-width: 400px; | |
padding: 10px 12px; | |
font-size: 1rem; |
This file contains hidden or 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
namespace InputsDemo; | |
internal partial class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var value = Prompts.GetDate(); | |
Console.WriteLine(value.Year == 1 ? "Cancelled" : $"Selected date: {value:MM/dd/yyyy HH:mm}"); | |
Console.ReadLine(); | |
} |
This file contains hidden or 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 class CatalogInfo | |
{ | |
public string ProductDisplayVersion { get; set; } | |
} |
This file contains hidden or 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.Xml.Linq; | |
namespace UpdateFrameworkApp.Classes; | |
public class ProjectUpdater | |
{ | |
public static string UpdateTargetFramework(string csprojPath, string oldFramework = "net7.0", string newFramework = "net9.0") | |
{ | |
if (!File.Exists(csprojPath)) | |
{ |
This file contains hidden or 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
DECLARE @TableName AS NVARCHAR(MAX) = 'Birthdays' | |
SELECT | |
X.COLUMN_NAME AS ColumnName, | |
X.ORDINAL_POSITION AS Position, | |
X.TABLE_CATALOG AS Catalog, | |
X.TABLE_SCHEMA AS TableSchema, | |
X.COLUMN_DEFAULT AS ColumnDefault, | |
X.DATA_TYPE AS DataType, | |
CASE | |
WHEN KCU.COLUMN_NAME IS NOT NULL THEN CAST(1 AS BIT) |
This file contains hidden or 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
// create a method in DapperOperations.cs named GetImageById using Dapper | |
public class DapperOperations | |
{ | |
private readonly string _connectionString; | |
public DapperOperations(string connectionString) | |
{ | |
_connectionString = connectionString; | |
} |
This file contains hidden or 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 string CalculateTimeDifference(DateTime futureDate) | |
{ | |
if (futureDate <= DateTime.Now) | |
{ | |
return "The provided date must be in the future."; | |
} | |
DateTime now = DateTime.Now; | |
// Calculate total months difference |
This file contains hidden or 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 record Person(string FirstName, string LastName, DateOnly BirthDate, string[] PhoneNumbers) | |
{ | |
protected virtual bool PrintMembers(StringBuilder sb) | |
{ | |
sb.Append($"FirstName = {FirstName}, LastName = {LastName}, Birth = {BirthDate:MM/dd/yyyy}"); | |
if (!(PhoneNumbers?.Length > 0)) return true; | |
sb.Append(", PhoneNumbers: "); | |
sb.Append(string.Join(", ", PhoneNumbers)); |
This file contains hidden or 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 DateTimeHelpers | |
{ | |
/// <summary> | |
/// Generates a list of dates representing the next week's dates starting from the upcoming Sunday. | |
/// </summary> | |
/// <returns>A list of <see cref="DateOnly"/> objects representing the dates of the next week.</returns> | |
public static List<DateOnly> NextWeeksDates() | |
{ | |
var start = DateTime.Now; | |
var nextSunday = DateOnly.FromDateTime(start).Next(DayOfWeek.Sunday); |
This file contains hidden or 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
/// <summary> | |
/// Provides a custom JSON converter for <see cref="decimal"/> values, ensuring consistent formatting and parsing. | |
/// </summary> | |
/// <remarks> | |
/// This converter reads <see cref="decimal"/> values from JSON as strings and parses them using | |
/// <see cref="CultureInfo.InvariantCulture"/>. When writing, it formats <see cref="decimal"/> values | |
/// as strings with two decimal places using the same culture. | |
/// </remarks> | |
public class FixedDecimalJsonConverter : JsonConverter<decimal> | |
{ |
NewerOlder