Skip to content

Instantly share code, notes, and snippets.

public T RandomItem()
{
int randomRI = 0;
Random random = new Random();
lock (random)
{
randomRI = random.Next(0, this.Count - 1);
}
return this[randomRI];
}
string[] ids = this.Parameters["OrderByRank"].Split(',');
for (int x = 0; x < ids.Length; x++)
{
Event foundevent = ec.Find(delegate(Event e)
{
return e.ViewID == ids[x];
});
if (foundevent != null)
foundevent.Order = -1000 + x; // start at -1000 because the default order is 0
}
public delegate BaseGenericList<T> MethodExecution<T>();
public static BaseGenericList<T> GetCachedList<T>(string key, object[] argsKey, MethodExecution<T> method)
{
BaseGenericList<T> list = new BaseGenericList<T>();
T[] listarray = (T[])CacheConfig.DeCache(key, argsKey);
if (listarray == null)
{
list = method();
CacheConfig.EnCache(key, list.ToArray(), argsKey);
}
namespace Mofo.Framework.Components
{
public class Lookup<T>
{
public T ID { get; set; }
public string Name { get; set; }
}
}
namespace Mofo.Framework.Components
public static List<T> LoadLookup<T, U>(IDataReader reader) where T : ILookup<U>, new()
{
List<T> list = new List<T>();
try
{
while (reader.Read())
{
T lookup = new T();
lookup.ID = (U)reader["ID"];
lookup.Name = (string)reader["Name"];
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[Tombstones_SearchTombstones]
@industry_id smallint = null,
@region_id_list varchar(8000) = null,
@inbound_region_id_list varchar(8000) = null,
@outbound_region_id_list varchar(8000) = null
AS
public static string ToIDList<T, U>(List<U> lookuplist) where U : ILookup<T> where T : struct
{
List<U> lookupidlist = lookuplist.FindAll(delegate(U lookup)
{
return lookup.ID.HasValue;
});
string idlist = String.Empty;
if (lookupidlist != null)
{
string[] ids = new string[lookupidlist.Count];
public delegate T MethodExecution<T>(IDataReader reader);
public static List<T> LoadList<T>(IDataReader reader, MethodExecution<T> method)
{
return LoadList<T>(reader, true, method);
}
public static List<T> LoadList<T>(IDataReader reader, bool close_reader, MethodExecution<T> method)
{
List<T> list = new List<T>();
try
{
' VB.Net 2.0
' a class for videos is what I was using my original code for
Public Class Video
Private _id As Integer
Public Property Id() As Integer
Get
Return _id
End Get
Set(ByVal value As Integer)
// bookmarklet to introspect the source of current page
javascript:(function(d,h){h=d.documentElement.innerHTML;d.open();d.write('<pre>'+('<!DOCTYPE html><html>'+h+'</html>').replace(/[<>]/g,function(m){return{'<':'&lt;','>':'&gt;'}[m]})+'</pre>')})(document);