Format:
Recent snippets matching tags of C#
public static class Extensions { public static IEnumerable<T> Select<T>( this SqlDataReader reader, Func<SqlDataReader, T> projection) { while (reader.Read()) { yield return projection(reader); } } }
25 Views
no comments
So I have a database that has two columns I want to access: YEAR EQ_MAG_MW I'm using the following C# code to try to get at the data into a string called year but it isn't working: <code> int columnIndex = reader.GetOrdinal("YEAR");<br /> string year = reader.GetString(columnIndex);
35 Views
no comments
using Moq; using NUnit.Framework; using StructureMap; namespace StackOverflow.Question { #region Commands public interface ICommand {
23 Views
no comments
namespace System.Threading { /// <summary> /// Extensions for <see cref="SynchronizationContext"/>. /// </summary> public static class SynchronizationContextExtensions { /// <summary> /// Dispatches an <b>asynchronous</b> message to a synchronization context.
38 Views
1 comments
using System; using System.Collections.Generic; using System.Linq; using System.Dynamic; using System.Reflection; using System.Collections; namespace Westwind.Utilities.Dynamic { /// <summary>
569 Views
2 comments
protected void Page_Load(object sender, EventArgs e) { if (HttpContext.Current.Request.IsAuthenticated) { ResetFormsAuthenticationTicket(); } else { Response.Redirect("~/logout.aspx"); }
43 Views
no comments
using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using System.Web; namespace System.Text { public static class StringTransformer { static readonly string linkFormat = "<a href=\"{0}\" title=\"{0}\" target=\"{2}\" class=\"{3}\">{1}</a>"; /// <summary>
99 Views
no comments
using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Web; /// <summary> /// Summary description for OrderByHelper /// </summary>
61 Views
no comments
// FlowDesign C#, classic EBC // 4.1.2012, Christof Konstantinopoulos // Diagram : https://cacoo.com/diagrams/Vy5LOUn5NfhTARzj // File : Program.cs namespace FlowDesign_KlassischesEBC { class Program {
79 Views
1 comments
using System; using System.Text; namespace MwSt_cSharp { class Program { static Platine MainBoard = null; static void Main(string[] args)
59 Views
no comments
namespace Westwind.Utilities.Data { /// <summary> /// This class provides an easy way to turn a DataRow /// into a Dynamic object that supports direct property /// access to the DataRow fields. /// /// The class also automatically fixes up DbNull values /// (null into .NET and DbNUll to DataRow) /// </summary>
294 Views
no comments
namespace DataFieldMappingConsoleSample { using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Linq; class Program {
61 Views
no comments
namespace DataFieldMappingConsoleSample { using System; using System.Collections.Generic; using System.Data; using System.Diagnostics; using System.Linq; using System.Reflection; [AttributeUsage(AttributeTargets.Property)]
51 Views
no comments
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Security.Cryptography; namespace Westwind.Web.Services { /// <summary> /// Implements the Gravatar API for retrieving a Gravatar image to display
261 Views
2 comments
Rectangle m_Rectangle;
TranslateTransform m_Transform;
Microsoft.Devices.Sensors.Accelerometer m_Accelerometer;
public MainPage()
{
InitializeComponent();
Loaded += MainPage_Loaded;
Unloaded += (s, e) => { m_Accelerometer.Stop(); };
}
277 Views
no comments
static void Main(string[] args) { Console.WriteLine(PhoneNumber("12345678901234")); Console.WriteLine(PhoneNumber("1234567890123")); Console.WriteLine(PhoneNumber("123456789012")); Console.WriteLine(PhoneNumber("12345678901")); Console.WriteLine(PhoneNumber("1234567890")); Console.WriteLine(PhoneNumber("123456789")); Console.WriteLine(PhoneNumber("12345678")); Console.WriteLine(PhoneNumber("1234567"));
105 Views
no comments
public abstract class ViewModelBase : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; protected void RaisePropertyChanged(string property) { if (PropertyChanged == null) return; PropertyChanged(this, new PropertyChangedEventArgs(property)); PropertyChanged(this,
148 Views
no comments
public static IEnumerable<Orders> ExcludeOrderTypes(this IEnumerable<Orders> orders, int[] orderTypeIdsToExclude) { if ((orders == null || orders.Count == 0)) { return new List<Orders>(); } if ((orderTypeIdsToExclude == null)) { return orders; }
60 Views
no comments
// Format names as one comma delimited string var names = string.Join(", ", (from p in people select d.Name).ToArray());
88 Views
no comments
public MainPage() { InitializeComponent(); var _List = new List<InputScopeNameValue>(); for (int i = 0; i < 100; i++) _List.Add((InputScopeNameValue)i); listBox1.ItemsSource = _List; }
103 Views
1 comments
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search
