First statement concatenates schema
with table name
while the second statement separates schema name
and table 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
using System.Text.RegularExpressions; | |
public static class StringExtensions | |
{ | |
// remove double spaces | |
public static string RemoveExtraSpaces(this string sender, bool trimEnd = false) | |
{ | |
const RegexOptions options = RegexOptions.None; | |
var regex = new Regex("[ ]{2,}", options); | |
var result = regex.Replace(sender, " "); |
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 string GetNetCoreVersion() | |
{ | |
var assembly = typeof(System.Runtime.GCSettings).GetTypeInfo().Assembly; | |
var assemblyPath = assembly.CodeBase.Split(new[] { '/', '\\' }, StringSplitOptions.RemoveEmptyEntries); | |
int netCoreAppIndex = Array.IndexOf(assemblyPath, "Microsoft.NETCore.App"); | |
if (netCoreAppIndex > 0 && netCoreAppIndex < assemblyPath.Length - 2) | |
return assemblyPath[netCoreAppIndex + 1]; | |
return null; | |
} |
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 void UpdateSpecificField(Employees entity, params Expression<Func<Employees, object>>[] updatedProperties) | |
{ | |
foreach (var property in updatedProperties) | |
{ | |
_context.Entry(entity).Property(property).IsModified = true; | |
} | |
} |
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 Extensions | |
{ | |
public static void ForEachWithIndex<T>(this IEnumerable<T> sender, Action<T, int> handler) | |
{ | |
int idx = 0; | |
foreach (T item in sender) | |
{ | |
handler(item, idx++); | |
} | |
} |
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 DataGridViewExtensions | |
{ | |
/// <summary> | |
/// Write entire contents, rows and cells to a text file | |
/// </summary> | |
/// <param name="sender">DataGridView with rows and columns</param> | |
/// <param name="fileName">Path and file name to write too</param> | |
/// <param name="defaultNullValue">Default value for null or empty cells</param> | |
public static void ExportRows(this DataGridView sender, string fileName, string defaultNullValue = "(empty)") | |
{ |
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 Serilog.Sinks.SystemConsole.Themes; | |
namespace SeriLogLibrary; | |
public class SeriLogCustomThemes | |
{ | |
/// <summary> | |
/// Custom theme.<br/> | |
/// Text: Green<br/> | |
/// String: Yellow<br/> |
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
CREATE TABLE #ItemBids | |
( | |
ItemID int NOT NULL IDENTITY(1,1), | |
ItemName varchar(20) NOT NULL, | |
BidPrice1 DECIMAL(19, 2) NOT NULL, | |
BidPrice2 DECIMAL(19, 2) NOT NULL, | |
BidPrice3 DECIMAL(19, 2) NOT NULL, | |
BidPrice4 DECIMAL(19, 2) NOT NULL, | |
BidPrice5 DECIMAL(19, 2) NOT NULL, | |
); |
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 Microsoft.AspNetCore.WebUtilities; | |
using Microsoft.Extensions.Primitives; | |
using System.Collections.Specialized; | |
using System.Diagnostics; | |
namespace QueryHelpersApp; | |
internal partial class Program | |
{ | |
static void Main(string[] args) |
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 enum Country | |
{ | |
USA, | |
Canada, | |
Mexico, | |
Japan | |
} |