Snippets Collections
int minLavel = Convert.ToInt32(dt.Compute("min([AccountLevel])", string.Empty));
private void Find(string value)
{
  if (string.IsNullOrEmpty(value)) return;

  foreach (DataGridViewRow Row in Flex.Grid.Rows)
  {
    String strFila = Row.Index.ToString();
    foreach (DataGridViewCell cell in Row.Cells)
    {
      string Valor = Convert.ToString(cell.Value);

      if (Valor.ToLower().Trim().Contains(value.ToLower().Trim()))
      {
        Flex.Grid.CurrentCell = Flex.Grid.Rows[Convert.ToInt32(strFila)].Cells[0];
        Flex.Grid.Rows[Convert.ToInt32(strFila)].Selected = true;
        Flex.Grid.Select();
      }
    }
  }
}
List<DataRow> result = new List<DataRow>();

/*
	result = (from x in dt.AsEnumerable() where 
    (x.Field<string>("Code").ToLower().Contains(Value) || 
     x.Field<string>("Description").ToLower().Contains(Value)) && 
    (x.Field<bool>("Active") == true)
     select x).ToList();
*/

result = (from x in dt.AsEnumerable() where x.Field<bool>("Active") == true select x).ToList();

if (result.Count >= 1)
{
  dt = result.CopyToDataTable();
  Bridge.InPut.Code = dt.Rows[0]["Code"].ToString().Trim();
  Bridge.InPut.Description = dt.Rows[0]["Description"].ToString().Trim();
  return;
}
foreach (DataGridViewRow Row in resultadosdelaconsulta.Rows)
    {
        String strFila = Row.Index.ToString();
        foreach(DataGridViewCell cell in Row.Cells)
            {
              string Valor = Convert.ToString(cell.Value);
              if (Valor == this.BuscarEnDGB.Text)
                  {
resultadosdelaconsulta.Rows[Convert.ToInt32(strFila) ].DefaultCellStyle.BackColor = Color.Red;
            }
        }
        
    }
TextBox firstTextBox = this.Controls.OfType<TextBox>().FirstOrDefault();
if(firstTextBox != null)
    firstTextBox.Focus();
asm = System.Reflection.Assembly.Load(aName)
string[] manifest = asm.GetManifestResourceNames();

using (UnmanagedMemoryStream stream = (UnmanagedMemoryStream)asm.GetManifestResourceStream(manifest[0]))//The Index of the Image you want to use
{
    using (MemoryStream ms1 = new MemoryStream())
    {
        stream.CopyTo(ms1);
        BitmapImage bmi = new BitmapImage();
        bmi.BeginInit();
        bmi.StreamSource = new MemoryStream(ms1.ToArray());
        bmi.EndInit();
        image1.Source  = bmi; //The name of your Image Control
    }

}
foreach (DataRow dr in dataTable1.Rows) {
    if (/* some condition */)
        dataTable2.Rows.Add(dr.ItemArray);
}
var errors = ModelState
    .Where(x => x.Value.Errors.Count > 0)
    .Select(x => new { x.Key, x.Value.Errors })
    .ToArray();
using System.ComponentModel;

string errorMessage = new Win32Exception(Marshal.GetLastWin32Error()).Message;
Console.WriteLine(errorMessage);
dt = dt.AsEnumerable()
       .GroupBy(r => new {Col1 = r["Col1"], Col2 = r["Col2"]})
       .Select(g => g.OrderBy(r => r["PK"]).First())
       .CopyToDataTable();
string JSONresult;
JSONresult = JsonConvert.SerializeObject(dt);  
Response.Write(JSONresult);
namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] stringArray = {"hey", "Tom"};

            for (int i = 0; i < stringArray.Length; i++ )
            {
                stringArray[i] += "  dad";
                Console.WriteLine(stringArray[i]);
            }

            Array.Resize(ref stringArray, stringArray.Length + 1);

            // Add bob to the last element of the array
            stringArray[stringArray.Length - 1] =" bob";

            foreach (string s in stringArray)
            {
                string b = s + "sad";
                Console.WriteLine(s);
                //Console.WriteLine(stringArray);
            }
        }
    }
}
MyClass myClass = new MyClass();
Type myClassType = myClass.GetType();
PropertyInfo[] properties = myClassType.GetProperties();

foreach (PropertyInfo property in properties)
{
    Console.WriteLine("Name: " + property.Name + ", Value: " + property.GetValue(myClass, null));
}
SmtpClient smtpClient = new SmtpClient();
NetworkCredential smtpCredentials = new NetworkCredential("email from","password");

MailMessage message = new MailMessage();
MailAddress fromAddress = new MailAddress("email from");
MailAddress toAddress = new MailAddress("email to");

smtpClient.Host = "smpt host address";
smtpClient.Port = your_port;
smtpClient.EnableSsl = true;
smtpClient.UseDefaultCredentials = false;
smtpClient.Credentials = smtpCredentials;
smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
smtpClient.Timeout = 20000;

message.From = fromAddress;
message.To.Add(toAddress);
message.IsBodyHtml = false;
message.Subject = "example";
message.Body = "example";

smtpClient.Send(message);
Assembly assembly = Assembly.LoadFrom("TestAssembly.dll");
Version ver = assembly.GetName().Version;
using System.Reflection;

infoFileVersionInfo versInfo = FileVersionInfo.GetVersionInfo("path.exe");
string version = $"v{versInfo.FileMajorPart}.{versInfo.FileMinorPart}.{versInfo.FileBuildPart}";
OpenFileDialog folderBrowser = new OpenFileDialog();
// Set validate names and check file exists to false otherwise windows will
// not let you select "Folder Selection."
folderBrowser.ValidateNames = false;
folderBrowser.CheckFileExists = false;
folderBrowser.CheckPathExists = true;
// Always default to Folder Selection.
folderBrowser.FileName = "Folder Selection.";
if (folderBrowser.ShowDialog() == DialogResult.OK)
{
    string folderPath = Path.GetDirectoryName(folderBrowser.FileName);
    // ...
}
Private Sub GetProjectReferences()
    Dim lines = New List(Of String)
    Dim path = "..\..\TestApp.vbproj"
    For Each line In File.ReadAllLines(path)
        If line.Contains("<ProjectReference") Then
            Dim projNameWithExtension = line.Substring(line.LastIndexOf("\") + 1)
            Dim projName = projNameWithExtension.Substring(0, projNameWithExtension.IndexOf(".vbproj"))
            lines.Add(projName)
        End If
    Next
End Sub
// you need to reference System.Web.Extensions

using System.Web.Script.Serialization;

var jsonSerialiser = new JavaScriptSerializer();
var json = jsonSerialiser.Serialize(aList);
name = name.TrimEnd('\\').Remove(name.LastIndexOf('\\') + 1);
public class DynamicClass : DynamicObject
{
    private Dictionary<string, KeyValuePair<Type, object>> _fields;

    public DynamicClass(List<Field> fields)
    {
        _fields = new Dictionary<string, KeyValuePair<Type, object>>();
        fields.ForEach(x => _fields.Add(x.FieldName,
            new KeyValuePair<Type, object>(x.FieldType, null)));
    }

    public override bool TrySetMember(SetMemberBinder binder, object value)
    {
        if (_fields.ContainsKey(binder.Name))
        {
            var type = _fields[binder.Name].Key;
            if (value.GetType() == type)
            {
                _fields[binder.Name] = new KeyValuePair<Type, object>(type, value);
                return true;
            }
            else throw new Exception("Value " + value + " is not of type " + type.Name);
        }
        return false;
    }

    public override bool TryGetMember(GetMemberBinder binder, out object result)
    {
        result = _fields[binder.Name].Value;
        return true;
    }
}
var json = File.ReadAllText("Demo.json");

Dictionary<string, string> dict = new Dictionary<string, string>();

dict = JsonConvert.DeserializeObject<Dictionary<string, string>>(json);

var list = dict.ToList();
if(!Exists(new PhysicalResource())) //Check to see if a physical resource exists.
{
    PhysicalResource.Create(); //Extract embedded resource to disk.
}

PhysicalResource pr = new PhysicalResource(); //Create physical resource instance.

pr.Read(); //Read from physical resource.

pr.Write(); //Write to physical resource.
dt = dt.AsEnumerable()
       .GroupBy(r => new {Col1 = r["Col1"], Col2 = r["Col2"]})
       .Select(g => g.OrderBy(r => r["PK"]).First())
       .CopyToDataTable();
    public static string GetResourceFileContentAsString(string fileName)
    {
        var assembly = Assembly.GetExecutingAssembly();
        var resourceName = "Your.Namespace." + fileName;

        string resource = null;
        using (Stream stream = assembly.GetManifestResourceStream(resourceName))
        {
            using (StreamReader reader = new StreamReader(stream))
            {
                resource = reader.ReadToEnd();
            }
        }
        return resource;
    }
DataTable dt = new DataTable();
dt = SecondDataTable.Copy();    
dt .TableName = "New Name";
DataSet.Tables.Add(dt );
var filteredOrders = from order in orders.Order
                     where allowedStatus.Contains(order.StatusCode)
                     select order;
private void button35_Click_1(object sender, EventArgs e)
{
    Form form = new Form();
    //form.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
    //form.MaximizeBox = false;
    //form.MinimizeBox = false;
    //form.ControlBox = false;
    form.BackColor = Color.Fuchsia;
    form.TransparencyKey = form.BackColor;
    form.BackgroundImage = Image.FromFile("D:\\pie.png");
    form.Paint += form_Paint;
    //form.MouseDown += form_MouseDown;
    form.Show();
}

void form_Paint(object sender, PaintEventArgs e)
{
    using (Image img = Image.FromFile("D:\\proj.png"))
    e.Graphics.DrawImage(img, Point.Empty);
}

//void form_MouseDown(object sender, MouseEventArgs e)
//{
//    if (e.Button == MouseButtons.Left)
//    {
//        ReleaseCapture();
//        SendMessage( ((Form)sender).Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
//    }
//}

//public const int WM_NCLBUTTONDOWN = 0xA1;
//public const int HT_CAPTION = 0x2;
//[DllImportAttribute("user32.dll")]
//public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
//[DllImportAttribute("user32.dll")]
//public static extern bool ReleaseCapture();
<ItemGroup> 
  <Content Include="AppData\**"> 
    <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 
  </Content> 
</ItemGroup>
string[] coords = str.Split(',');

Point point = new Point(int.Parse(coords[0]), int.Parse(coords[1]));
List<string> toRemove = dt.Columns.Cast<DataColumn>().Where(c => c.ColumnName.StartsWith("ExtraColumn")).Select(c => c.ColumnName).ToList();
foreach (var col in toRemove) dt.Columns.Remove(col);
var ids = dt.AsEnumerable().Select(r => r.Field<int>("id")).ToList();
private List<MyObj> test(DataTable dt)
{
       
    var convertedList = (from rw in dt.AsEnumerable()
        select new MyObj() 
        {
            ID = Convert.ToInt32(rw["ID"]),
            Name = Convert.ToString(rw["Name"])
        }).ToList();

    return convertedList;
}
SomeObject obj = new SomeObject();
obj.PutInThread(thatOtherThread);
obj.Method(); // this now executes in that other thread
public static string FirstCharToUpper(string input)
{
    if (String.IsNullOrEmpty(input))
        throw new ArgumentException("ARGH!");
    return input.First().ToString().ToUpper() + input.Substring(1);
}
int n;
bool isNumeric = int.TryParse("123", out n);
// Create a DataTable and add two Columns to it
DataTable dt=new DataTable();
dt.Columns.Add("Name",typeof(string));
dt.Columns.Add("Age",typeof(int));

// Create a DataRow, add Name and Age data, and add to the DataTable
DataRow dr=dt.NewRow();
dr["Name"]="Mohammad"; // or dr[0]="Mohammad";
dr["Age"]=24; // or dr[1]=24;
dt.Rows.Add(dr);

// Create another DataRow, add Name and Age data, and add to the DataTable
dr=dt.NewRow();
dr["Name"]="Shahnawaz"; // or dr[0]="Shahnawaz";
dr["Age"]=24; // or dr[1]=24;
dt.Rows.Add(dr);

// DataBind to your UI control, if necessary (a GridView, in this example)
GridView1.DataSource=dt;
GridView1.DataBind();
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    TextBox1.Text = "Bernard" + vbTab + "32"
    TextBox2.Text = "Luc" + vbTab + "47"
    TextBox3.Text = "François-Victor" + vbTab + "12"
End Sub
var query = dTable.AsEnumerable().Where(r => r.Field<string>("col1") == "ali");

foreach(var row in query.ToList())
   row.Delete();
using (Image image = Image.FromFile(Path))
{
    using (MemoryStream m = new MemoryStream())
    {
        image.Save(m, image.RawFormat);
        byte[] imageBytes = m.ToArray();

        // Convert byte[] to Base64 String
        string base64String = Convert.ToBase64String(imageBytes);
        return base64String;
    }
}
 //Loop over rows

 for (int i = 0; i < datagridview.Rows.Count; i++)
 {
    //Use when column names known
    datagridview.Rows[i].Cells["columnName"].Value  = value;
    //Use when column index known
    datagridview.Rows[i].Cells[1].Value  = value;   
 }
using System.Drawing;
Color myColor = Color.FromArgb(255, 181, 178);
string hex = myColor.R.ToString("X2") + myColor.G.ToString("X2") + myColor.B.ToString("X2");
public static int DiceSum4(IEnumerable<object> values)
{
    var sum = 0;
    foreach (var item in values)
    {
        switch (item)
        {
            case 0:
                break;
            case int val:
                sum += val;
                break;
            case IEnumerable<object> subList when subList.Any():
                sum += DiceSum4(subList);
                break;
            case IEnumerable<object> subList:
                break;
            case null:
                break;
            default:
                throw new InvalidOperationException("unknown item type");
        }
    }
    return sum;
}
DataTable dtTable;

MySQLProcessor.DTTable(mysqlCommand, out dtTable);

// On all tables' rows
foreach (DataRow dtRow in dtTable.Rows)
{
    // On all tables' columns
    foreach(DataColumn dc in dtTable.Columns)
    {
      var field1 = dtRow[dc].ToString();
    }
}
String.Join(",", myArray.Where(s => !string.IsNullOrEmpty(s)))
protected override void OnExit(ExitEventArgs e) {
    base.OnExit(e); 
}
class Car
{
    ~Car()  // destructor
    {
        // cleanup statements...
    }
}

protected override void Finalize()
{
    try
    {
        // Cleanup statements...
    }
    finally
    {
        base.Finalize();
    }
}

using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;

namespace AppsensPro.Infrastructure.Threading
{
    public sealed class KeyedLock<TKey>
    {
        /// <summary>
        /// Simple wrapper to allow counting how many references an object has
        /// </summary>
        /// <typeparam name="T"></typeparam>
        private sealed class RefCounted<T>
        {
            public RefCounted(T value)
            {
                RefCount = 1;
                Value = value;
            }

            public int RefCount { get; set; }
            public T Value { get; private set; }
        }

        /// <summary>
        /// Internally maintained dictionary of <see cref="SemaphoreSlim"/>
        /// </summary>
        private readonly Dictionary<TKey, RefCounted<SemaphoreSlim>> _semaphoreSlims
            = new Dictionary<TKey, RefCounted<SemaphoreSlim>>();

        /// <summary>
        /// Atomically get or create a value, with the associated <see cref="RefCounted{T}"/> incremented
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        private SemaphoreSlim GetOrCreate(TKey key)
        {
            RefCounted<SemaphoreSlim> item;
            lock (_semaphoreSlims)
            {
                if (_semaphoreSlims.TryGetValue(key, out item))
                {
                    ++item.RefCount;
                }
                else
                {
                    item = new RefCounted<SemaphoreSlim>(new SemaphoreSlim(1, 1));
                    _semaphoreSlims[key] = item;
                }
            }
            return item.Value;
        }

        /// <summary>
        /// Lock with specified key, returning a disposable <see cref="Releaser"/>
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public IDisposable Lock(TKey key)
        {
            GetOrCreate(key).Wait();
            return new Releaser(key, _semaphoreSlims);
        }

        /// <summary>
        /// Asynchronously lock with specified key, returning a disposable <see cref="Releaser"/>
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public async Task<IDisposable> LockAsync(TKey key)
        {
            await GetOrCreate(key).WaitAsync().ConfigureAwait(false);
            return new Releaser(key, _semaphoreSlims);
        }

        /// <summary>
        /// The returned Disposable <see cref="Releaser"/>.
        /// The lock will only be removed from dictionary if exists no reference left
        /// </summary>
        private sealed class Releaser : IDisposable
        {
            private TKey _key;
            private readonly Dictionary<TKey, RefCounted<SemaphoreSlim>> _locks;

            public Releaser(TKey key, Dictionary<TKey, RefCounted<SemaphoreSlim>> locks)
            {
                _key = key;
                _locks = locks;
            }
            
            public void Dispose()
            {
                RefCounted<SemaphoreSlim> item;
                lock (_locks)
                {
                    item = _locks[_key];
                    --item.RefCount;
                    if (item.RefCount == 0)
                        _locks.Remove(_key);
                }
                item.Value.Release();
            }
        }
    }
}
List<MyType> listName = dataTableName.AsEnumerable().Select(m => new MyType()
{
   ID = m.Field<string>("ID"),
   Description = m.Field<string>("Description"),
   Balance = m.Field<double>("Balance"),
}).ToList()
if(!String.IsNullOrEmpty(richTextBox_MWE.Text) && richTextBox_MWE.Text.Trim().Contains(textBox1.Text.Trim()))
{
  label5.BackColor = Color.Green;
}
    private void timer1_Tick_1(object sender, EventArgs e)
    {
        int x = panel2.Size.Width;
        int y = panel2.Size.Height;
        panel2.Size = new Size(x + 10, y);
        panel2.Location = new Point(panel2.Location.X - 10, panel2.Location.Y);
        if (x>150)
        {
            timer1.Stop();
        }
    }
private void btnChoose_Click(object sender, EventArgs e)
{

    MouseEventArgs b = new MouseEventArgs(System.Windows.Forms.MouseButtons.Left, 2, 
        MousePosition.X, MousePosition.Y, 0);
    DataGridViewCellMouseEventArgs a = new DataGridViewCellMouseEventArgs(0, 0, 
        MousePosition.X, MousePosition.Y, b);
    dataGridView1_CellMouseDoubleClick(sender, a);
}
    private void button6_Click(object sender, EventArgs e)
    {

        ListDataGridView_CellDoubleClick(this.ListDataGridView, new DataGridViewCellEventArgs(this.ListDataGridView.CurrentCell.ColumnIndex,this.ListDataGridView.CurrentRow.Index));

    }
var query = dTable.AsEnumerable().Where(r => r.Field<string>("col1") == "ali");

foreach(var row in query.ToList())
   row.Delete();
(new System.Diagnostics.StackTrace()).GetFrame(1).GetMethod().Name
string projectName = Assembly.GetCallingAssembly().GetName().Name;
(new System.Diagnostics.StackTrace()).GetFrame(1).GetMethod().Name
FileInfo oFileInfo = new FileInfo(strFilename);

if (oFileInfo != null || oFileInfo.Length == 0)
{
   MessageBox.Show("My File's Name: \"" + oFileInfo.Name + "\"");
   // For calculating the size of files it holds.
   MessageBox.Show("myFile total Size: " + oFileInfo.Length.ToString());
}
  using System.Linq;

  ...

  int[] y = File
    .ReadAllText(@"F:/C#/graph/graph/bin/Debug/y.txt")
    .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
    .Select(item => int.Parse(item))
    .ToArray();

  string[] x = File
    .ReadAllText(@"F:/C#/graph/graph/bin/Debug/x.txt")
    .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
    .ToArray();
   using(System.IO.StreamReader sr = new System.IO.StreamReader("F:/C#/graph/graph/bin/Debug/x.txt"))
    {
        string line;
        while((line = sr.ReadLine()) != null)
        {
            string[] x = line.Split(' ');
        }
    }

   using(System.IO.StreamReader sr = new System.IO.StreamReader("F:/C#/graph/graph/bin/Debug/y.txt"))
    {
        string line;
        while((line = sr.ReadLine()) != null)
        {
            string[] yString = line.Split(' ');
        }
        int[] y = Array.ConvertAll(yString , s => int.Parse(s));

    }
ucProducto uc = new ucProducto(this);
//resto codigo
Panel1.Controls.Add(uc);
public Image Base64ToImage(string base64String)
{
   // Convert Base64 String to byte[]
    byte[] imageBytes = Convert.FromBase64String(base64String);
    MemoryStream ms = new MemoryStream(imageBytes, 0, imageBytes.Length);

    // Convert byte[] to Image
    ms.Write(imageBytes, 0, imageBytes.Length);
    Image image = Image.FromStream(ms, true);

    return image;
}
var query1 = dtClone.AsEnumerable().Select(row => row.Field<string>("department")).Distinct().OrderBy(s => s);
Process myProcess = new Process(); 
Process.Start("notepad++.exe", "\"c:\\file name for test.txt\"");
private void openLog() {
            try {
                // see if notepad++ is installed on user's machine
                var nppDir = (string)Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Notepad++", null, null);
                if (nppDir != null) {
                    var nppExePath = Path.Combine(nppDir, "Notepad++.exe");
                    var nppReadmePath = Path.Combine(yourDirectory,fileName );
                    var line = 20;
                    var sb = new StringBuilder();
                    sb.AppendFormat("\"{0}\" -n{1}", nppReadmePath, lineNo);
                    Process.Start(nppExePath, sb.ToString());
                } else {
                    string newPath = @"\\mySharedDrive\notpad++\bin\notepad++.exe";
                    Process.Start(newPath, @"\\" + filePath + " -n" + lineNo); // take exe from my shared drive
                }
            } catch (Exception e) {
                Process.Start(@"\\" + FilePath); // open using notepad
            }
        }
using System.Runtime.InteropServices;

public const int WM_NCLBUTTONDOWN = 0xA1;
public const int HT_CAPTION = 0x2;

[DllImportAttribute("user32.dll")]
public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
[DllImportAttribute("user32.dll")]
public static extern bool ReleaseCapture();

private void Form1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{     
    if (e.Button == MouseButtons.Left)
    {
        ReleaseCapture();
        SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
    }
}
public bool? IsActive { get; set; }

public string IsActiveDescriptor => IsActive.HasValue && IsActive ? "Yes" : "NO";
<div class="chart-wrapper">
@(Html.Kendo().Chart<ChartExample.Models.ChartModel>()
    .Name("chart")
    .Title("Example Column Chart")
    .Legend(legend => legend
        .Position(ChartLegendPosition.Top)
    )
    .DataSource(ds => ds.Read(read => read.Action("GetChartData", "Charts")))
    .Series(series => {
        series.Column(model => model.Val2).Name("Val2");
        series.Column(model => model.Val3).Name("Val3");
    })
    .CategoryAxis(axis => axis
        .Categories(model => model.Year)
        .Labels(labels => labels.Rotation(-90))
    )
    .ValueAxis(axis => axis.Numeric()
        .Labels(labels => labels.Format("{0:N0}"))
        .MajorUnit(10000)
    )
) 
</div>
public static MemoryStream GenerateStreamFromString(string value)
{
    return new MemoryStream(Encoding.UTF8.GetBytes(value ?? ""));
}
using System;
using System.Collections.Generic;

public class Program
{
    public static IEnumerable<int> GetRangeWithInverse( int count ) {
        for (var i = count; i > 0; i--) {
            yield return i;
            if (i > 1) {
                yield return count - i + 1;
            }
        }
    }

    public static void Main()
    {
        Console.WriteLine(string.Join( ',', GetRangeWithInverse( 10 ) ) );
    }
}
C:\Program Files\dotnet\sdk\1.0.0\NuGet.targets(97,5): error : Unable to load the service index for source https://{myaccount}.pkgs.visualstudio.com/_packaging/{myfeed}/nuget/v3/index.json.\r `[C:\Users\test\dotnet\dotnet.csproj]
C:\Program Files\dotnet\sdk\1.0.0\NuGet.targets(97,5): error :   Response status code does not indicate success: 401 (Unauthorized). [C:\Users\test\dotnet\dotnet.csproj]
<!DOCTYPE html>
<html>
<head>
<title>Font Awesome Icons</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>

<h1>fa fa-heart</h1>

<i class="fa fa-heart"></i>
<i class="fa fa-heart" style="font-size:24px"></i>
<i class="fa fa-heart" style="font-size:36px;"></i>
<i class="fa fa-heart" style="font-size:48px;color:red"></i>
<br>

<p>Used on a button:</p>
<button style="font-size:24px">Button <i class="fa fa-heart"></i></button>

<p>Unicode:</p>
<i style="font-size:24px" class="fa">&#xf004;</i>

</body>
</html> 
public class MyClass : INotifyPropertyChanged
{
    private string imageFullPath;

    protected void OnPropertyChanged(PropertyChangedEventArgs e)
    {
        PropertyChangedEventHandler handler = PropertyChanged;
        if (handler != null)
            handler(this, e);
    }

    protected void OnPropertyChanged(string propertyName)
    {
        OnPropertyChanged(new PropertyChangedEventArgs(propertyName));
    }

    public string ImageFullPath
    {
        get { return imageFullPath; }
        set
        {
            if (value != imageFullPath)
            {
                imageFullPath = value;
                OnPropertyChanged("ImageFullPath");
            }
        }
    }

    public event PropertyChangedEventHandler PropertyChanged;
}
string assemblyPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
star

Tue May 14 2024 03:43:49 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/2442525/how-to-select-min-and-max-values-of-a-column-in-a-datatable

#cs
star

Sun Jan 07 2024 03:53:34 GMT+0000 (Coordinated Universal Time)

#cs
star

Sun Jan 07 2024 03:51:33 GMT+0000 (Coordinated Universal Time)

#cs
star

Sun Jan 07 2024 03:39:28 GMT+0000 (Coordinated Universal Time) https://es.stackoverflow.com/questions/377503/buscar-un-dato-en-un-datagridview-sin-especificar-columnas

#cs
star

Sat Oct 21 2023 03:11:54 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/13757465/how-to-focus-the-first-control-from-the-tablelayoutpanel-on-new-button-click

#cs
star

Thu Aug 31 2023 15:01:33 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/14805080/how-do-you-retrieve-an-embedded-image-from-a-dll-for-wpf-image-control

#cs
star

Wed Aug 30 2023 15:48:43 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/4020270/copy-rows-from-one-datatable-to-another-datatable

#cs
star

Thu Aug 24 2023 12:58:11 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/1791570/modelstate-isvalid-false-why

#cs
star

Wed Jul 26 2023 06:10:22 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/1650838/getting-the-windows-system-error-code-title-description-from-its-hex-number

#cs
star

Mon May 08 2023 18:12:44 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/19407387/how-do-i-use-select-group-by-in-datatable-selectexpression

#cs
star

Mon May 08 2023 17:26:03 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/17398019/convert-datatable-to-json-in-c-sharp

#cs
star

Thu Apr 27 2023 03:52:10 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/16512161/using-a-foreach-loop-with-stringarray-in-c-sharp

#cs
star

Sun Mar 19 2023 03:29:22 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/10315073/how-to-get-property-name-and-its-value

#cs
star

Tue Feb 28 2023 15:41:48 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/25545649/send-email-with-c-sharp-cpanel-hosting

#cs
star

Mon Feb 27 2023 05:19:08 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/29772065/how-to-check-the-version-of-an-assembly-dll

#cs
star

Mon Feb 27 2023 05:14:51 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/11350008/how-to-get-exe-file-version-number-from-file-path

#cs
star

Mon Feb 27 2023 05:14:34 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/11624298/how-do-i-use-openfiledialog-to-select-a-folder

#cs
star

Mon Feb 27 2023 05:14:09 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/14305581/method-to-get-all-files-within-folder-and-subfolders-that-will-return-a-list

#cs
star

Mon Feb 27 2023 04:13:49 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/56055553/c-sharp-get-project-references-that-are-projects

#cs
star

Sun Feb 26 2023 14:27:53 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/9110724/serializing-a-list-to-json

#cs
star

Sat Feb 25 2023 17:24:35 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/2155668/remove-last-word-in-label-split-by

#cs
star

Fri Feb 24 2023 20:13:15 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/3862226/how-to-dynamically-create-a-class

#cs
star

Fri Feb 24 2023 19:34:39 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/44299807/how-to-convert-json-to-list-in-c-sharp-without-dependant-class

#cs
star

Thu Feb 23 2023 14:51:42 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/3736267/how-to-write-to-an-embedded-resource

#cs
star

Wed Jan 25 2023 15:49:20 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/19407387/how-do-i-use-select-group-by-in-datatable-selectexpression

#cs
star

Tue Jan 24 2023 20:07:27 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/27835301/read-the-content-of-file-by-getting-it-from-dll

#cs
star

Wed Jan 18 2023 15:59:24 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/12178823/adding-a-datatable-in-a-dataset

#cs
star

Tue Jan 17 2023 19:43:45 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/14257360/linq-select-objects-in-list-where-exists-in-a-b-c

#cs
star

Fri Jan 13 2023 16:43:34 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/39822808/c-sharp-transparency-key-not-working-correctly

#cs
star

Thu Jan 12 2023 20:52:03 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/54762744/net-core-include-folder-in-publish

#cs
star

Tue Jan 10 2023 14:54:34 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/2718350/how-to-convert-a-string-into-a-point

#cs
star

Sun Jan 08 2023 03:10:33 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/6775845/how-to-remove-more-datatable-columns-using-c-net

#cs
star

Sun Jan 08 2023 02:33:37 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/23735823/how-to-get-list-of-one-column-values-from-datatable

#cs
star

Fri Jan 06 2023 18:22:46 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/12834059/how-to-convert-datatable-to-object-type-list-in-c-sharp

#cs
star

Mon Dec 12 2022 15:26:42 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/3184531/how-do-you-put-an-object-in-another-thread

#cs
star

Thu Dec 08 2022 23:09:55 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/15418467/how-can-i-write-these-variables-into-one-line-of-code-in-c

#cs
star

Thu Dec 08 2022 22:58:46 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/4135317/make-first-letter-of-a-string-upper-case-with-maximum-performance

#cs
star

Thu Dec 08 2022 00:14:51 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/894263/identify-if-a-string-is-a-number

#cs
star

Fri Nov 11 2022 20:03:30 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/1042618/how-to-create-a-datatable-in-c-sharp-and-how-to-add-rows

#cs
star

Fri Nov 11 2022 18:41:00 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/366124/inserting-a-tab-character-into-text-using-c-sharp

#cs
star

Fri Oct 28 2022 14:30:27 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/18854395/how-to-delete-rows-from-datatable-with-linq

#cs
star

Fri Sep 30 2022 21:32:52 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/21325661/convert-an-image-selected-by-path-to-base64-string

#cs
star

Wed Sep 28 2022 15:03:20 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/41299873/update-datagridview-column-value

#cs
star

Tue Sep 20 2022 18:40:01 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/13354892/converting-from-rgb-ints-to-hex

#cs
star

Thu Aug 04 2022 11:36:18 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/14252293/add-a-additional-condition-to-case-statement-in-switch

#cs #javascript
star

Fri Jul 22 2022 04:52:17 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/7939146/how-to-foreach-a-column-in-a-datatable-using-c

#cs
star

Mon Jul 11 2022 02:46:09 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/16325995/string-join-method-that-ignores-empty-strings

#cs
star

Sun Jul 03 2022 23:13:06 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/12977924/how-do-i-properly-exit-a-c-sharp-application

#cs
star

Tue Jun 28 2022 14:41:06 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/13988334/difference-between-destructor-dispose-and-finalize-method

#cs
star

Fri Jun 10 2022 04:36:02 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/55283882/an-asyncduplicatelock-that-can-be-locked-on-all-keys

#cs
star

Fri May 20 2022 20:17:17 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/1427484/convert-datatable-to-listt

#cs
star

Thu May 12 2022 21:09:22 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/24327330/using-like-operator-in-if-operator-in-c-sharp

#cs
star

Thu May 12 2022 15:25:20 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/45868364/change-panel-size-dynamically-from-right-to-left

#cs
star

Wed May 11 2022 15:28:13 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/39015557/how-to-call-datagridview-cell-double-click-event-from-a-button

#cs
star

Wed May 11 2022 15:24:30 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/39015557/how-to-call-datagridview-cell-double-click-event-from-a-button

#cs
star

Mon May 02 2022 18:55:02 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/18854395/how-to-delete-rows-from-datatable-with-linq

#cs
star

Mon May 02 2022 14:37:51 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/171970/how-can-i-find-the-method-that-called-the-current-method

#cs
star

Mon May 02 2022 14:37:44 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/18316683/how-to-get-the-current-project-name-in-c-sharp-code

#cs
star

Mon May 02 2022 14:37:27 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/171970/how-can-i-find-the-method-that-called-the-current-method

#cs
star

Thu Apr 28 2022 07:32:22 GMT+0000 (Coordinated Universal Time) https://docs.telerik.com/devtools/winforms/knowledge-base/how-to-embed-chrome-browser-in-a-winforms-application

#cs
star

Wed Apr 27 2022 19:07:42 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/7861886/how-to-get-file-properties

#cs
star

Wed Apr 27 2022 19:05:24 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/54461489/i-want-to-replace-the-data-in-a-text-file-with-an-array-and-store-it-in-a-variab

#cs
star

Wed Apr 27 2022 18:59:55 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/54461489/i-want-to-replace-the-data-in-a-text-file-with-an-array-and-store-it-in-a-variab

#cs
star

Wed Apr 27 2022 18:59:17 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/20499878/how-to-open-a-url-in-new-window-using-webbrowser-control-in-c-sharp-windows-form

#cs
star

Wed Apr 27 2022 16:10:11 GMT+0000 (Coordinated Universal Time) https://es.stackoverflow.com/questions/18133/como-puedo-tener-acceso-a-un-control-desde-un-formulario-hijo

#cs
star

Sat Apr 16 2022 03:07:08 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/18827081/c-sharp-base64-string-to-jpeg-image

#cs
star

Tue Mar 22 2022 01:23:17 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/56590444/unable-to-cast-object-of-type-grouping-to-datarow-after-i-grouped-datatable-with

#cs
star

Mon Mar 14 2022 20:05:22 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/38247311/open-file-for-reading-with-notepad-in-c-sharp

#cs
star

Mon Mar 14 2022 20:04:49 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/13755233/how-to-launch-a-process-which-will-open-a-text-file-in-any-editor-and-automatica

#cs
star

Fri Mar 11 2022 20:00:58 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/7286837/how-to-move-form-in-c-net

#cs
star

Wed Feb 23 2022 10:52:38 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/20338154/mvc-model-boolean-display-yes-or-no

#cs
star

Fri Jan 28 2022 22:54:28 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/11885183/kendoui-charts-with-asp-net-mvc

#cs
star

Tue Jan 19 2021 22:32:47 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/1879395/how-do-i-generate-a-stream-from-a-string

#cs
star

Thu Nov 12 2020 23:44:51 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/64813297/printing-number-with-for-loops-in-c-sharp

#cs
star

Wed Oct 07 2020 13:45:16 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/43098017/dotnet-restore-failing-when-mixing-private-nuget-feed-and-nest

#cs
star

Mon Aug 10 2020 11:03:32 GMT+0000 (Coordinated Universal Time) https://www.w3schools.com/icons/tryit.asp?filename=tryicons_fa-heart

#html #cs #heart
star

Wed Jul 22 2020 21:22:57 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/2246777/raise-an-event-whenever-a-propertys-value-changed

#cs
star

Sun Jun 21 2020 06:50:46 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/38071639/c-sharp-get-assembly-executable-directory

#cs

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension