CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Format:
Recent snippets matching tags of list
C#
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Interactivity;
using System.Windows.Threading;
 
namespace Behaviors
{
    /// <summary>
    /// On ListBoxes using CanContentScroll=True (virtualized), WPF layout changes will make the scrollviewer reset to zero.
by SandRock   October 26, 2011 @ 12:01am
42 Views
no comments
 
C#
List<Product> products = new List<Product>();
 
products.Sort(delegate(Product p1, Product p2)
{
return p1.ProductName.CompareTo(p2.ProductName);
});
by jaredmroberts   October 21, 2011 @ 8:49am
Tags: List<>, Sort
43 Views
no comments
 
C#
public static IList<T> ToList<T>(this System.Data.SqlClient.SqlDataReader dr) where T : new()
       {
           Type type = typeof(T);
           if(System.Web.HttpContext.Current.Cache[type.Name + "_properties"] == null)
           {
               System.Web.HttpContext.Current.Cache.Insert(type.Name + "_properties", type.GetProperties().ToList());
           }
           IList<PropertyInfo> properties = (IList<PropertyInfo>)System.Web.HttpContext.Current.Cache[type.Name + "_properties"];
           IList<T> result = new List<T>();
           while(dr.Read())
by ofer   September 25, 2011 @ 3:18am
82 Views
no comments
 
/*
Implementing BFS using adjacency list
Author: Rahul P
Language: ANSI-c
*/
#include <stdio.h>
#include <stdlib.h>
 
#define INFINITY 999999
#define WHITE 0
by Rahul P   August 28, 2011 @ 9:15pm
34 Views
no comments
 
<asp:ListView ID="ListView_Example" runat="server" >
    <LayoutTemplate>
        <ul>
           <asp:PlaceHolder ID="PlaceHolder_Example" runat="server" />
        </ul>
    </LayoutTemplate>
    <ItemTemplate>
        <li>
           <a href="<%=Eval("ExampleLink")%>"><%=Eval("ExampleName")%></a><%=Eval("ExampleSeparator")%>
        </li>
by Egli   July 19, 2011 @ 7:10pm
Tags: .NET, ListView
70 Views
no comments
 
C#
DropDownList.SelectedIndex = DropDownList.Items.IndexOf(DropDownList.Items.FindByValue("Value"));
by Egli   July 18, 2011 @ 4:28pm
80 Views
no comments
 
C++
/*
 * Дек (свързан списък)
 *
 * @author Михаил Николов
 * @version 1.0
 * @date 4.06.2011
 *
 */
#include <iostream>
80 Views
no comments
 
C++
/*
 * Опашка (свързан списък)
 *
 * @author Михаил Николов
 * @version 1.0
 * @date 4.06.2011
 *
 */
#include <iostream>
70 Views
no comments
 
C#
/// <summary>
/// Serialize anything
/// </summary>
/// <param name="serializeMe"></param>
/// <returns></returns>
public static string Serialize<T>(T serializeMe)
{
    var serializer = new XmlSerializer(serializeMe.GetType());
    var ms = new MemoryStream();
    serializer.Serialize(ms, serializeMe);
by rawbert   February 25, 2011 @ 12:49am
97 Views
no comments
 
C#
/// <summary>
/// An entry that can be either a single ip or a range
/// </summary>
public class IpEntry
{
    public string StartRange { get; set; }
 
    public string EndRange { get; set; }
 
    public bool IsRange
by rawbert   January 17, 2011 @ 1:29am
196 Views
2 comments
 
// cria uma string com n caracteres
function IncStr( Str: String; Qtd: Integer ): String;
var v_Str: String;
begin
  v_Str := Str;
  While Length( SysUtils.Trim( Str ) ) < Qtd do
    Str := v_Str+ SysUtils.Trim(Str);
  // Retorno da Funcao.
  Result := Str;
end;
by Thiago Pedro   October 18, 2010 @ 6:56pm
167 Views
no comments
 
var
  list: TStringList;
begin
  list := TStringList;
  try
    list.Add( 'Testando' );
    ListBox1.Items.Assign( list );
  finally
    list.free;
  end;
by Thiago Pedro   September 02, 2010 @ 4:05pm
204 Views
no comments
 
Como faço para listar os tipos enumerados de força mais fácil e dinâmica num ComboBox?
 
Essa foi a pergunta de uma grande amigo meu hoje. Confesso que não tinha muita idéia de como fazer. Imagine a situação:
 
type
TMeuTipo = (Tipo1, Tipo2, Tipo3, Tipo4, Tipo5);
 
Como fazer isso aparecer em um ComboBox?
Bem, podemos transformar isso em Strings e então adicioná-lo ao Combo, mais ou menos assim:
by Adriano Santos   August 27, 2010 @ 12:02pm
287 Views
no comments
 
C#
// Define a list by enclosing the item type in brackets [int]
// and initialize its value.
 
Scores : [int] = [ 92, 100, 85, 62, 81, 100 ];
 
// Option A
 
// require the stream type to be specified on a property
PassingScores : int*
{
by Dan Vanderboom   June 16, 2010 @ 1:07pm
235 Views
no comments
 
C#
// Select all
ItemList.Items.Cast<ListItem>().All(a => a.Selected = true);
 
// Select correct value in Dropdownlist
dropDownList.SelectedIndex =
    dropDownList.Items.IndexOf(
        dropDownList.Items.FindByValue(BusinessCollection.ID.ToString()));
        
radioButtonList.SelectedIndex =
    radioButtonList.Items.IndexOf(
by Arjan   March 24, 2010 @ 12:48pm
197 Views
no comments
 
// ===================================================================
// Author: Matt Kruse <matt@mattkruse.com>
// WWW: http://www.mattkruse.com/
//
// NOTICE: You may use this code for any purpose, commercial or
// private, without any further permission from the author. You may
// remove this notice from your final code if you wish, however it is
// appreciated by the author if at least my web site address is kept.
//
// You may *NOT* re-distribute this code in any way except through its
330 Views
no comments
 
C++
/********************/
/* ListaCirculara.h */
/********************/
 
#ifndef LISTA_CIRCULARA
#define LISTA_CIRCULARA
 
struct nod
{
    nod *next;
by Parvulescu Cosmin   January 22, 2010 @ 7:46am
146 Views
no comments
 
C++
/**************************/
/* ListaDubluInlantuita.h */
/**************************/
 
#ifndef LISTA_DUBLA
#define LISTA_DUBLA
 
struct nod
{
    nod *llink;
by Parvulescu Cosmin   January 22, 2010 @ 7:44am
139 Views
no comments
 
C++
/***************************/
/* ListaSimpluInlantuita.h */
/***************************/
 
#ifndef LISTA_SIMPLA
#define LISTA_SIMPLA
 
struct nod
{
    int val;
by Parvulescu Cosmin   January 22, 2010 @ 5:28am
148 Views
no comments
 
C#
/// <summary>
        /// Sorts the list box in descending order
        /// </summary>
        /// <param name="pList">the list to sort</param>
        /// <param name="pByValue">Sort the list by values or text</param> 
        private void SortListBox(ref ListBox pList, bool pByValue)
        {
            var lListItems = new System.Collections.SortedList();
 
            //add listbox items to SortedList 
by Abhilash   November 13, 2009 @ 4:03am
1489 Views
no comments
 
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate