Using Delegates and Predicates

Posted in C# Programming on May 19th, 2010 by phoenixdigital


    public new TList<T> FindAll(Predicate<T> match) 
    {
      if (match == null)
        {
          throw new ArgumentNullException("match");
        }

      TList<T> result = new TList<T>();
      foreach (T item in this.Items)
      {
        if (match(item))
        {
          result.Add(item);
        }
      }
      return result;
    }


list.FindAll(delegate(TempAddItem t) { return t.ShortCode.Trim() == 'Test'; });

Tags: , ,

HTTP Post from code behind in C#

Posted in C# Programming on January 21st, 2010 by phoenixdigital

Sometimes you may be required to send some data to a remote site from the code behind via HTTP. Generally this can easily be perfomed if the site allows for GET submissions. However sometimes the site will only accept POST submissions.
Read more »

Tags: , , ,

Linq Basics

Posted in C# Programming on October 28th, 2009 by phoenixdigital

Some basic code blocks for using linq covering some of the major areas.
Read more »

Tags: , , , ,

XML Request Response in C#

Posted in C# Programming on August 26th, 2009 by phoenixdigital

The following code example performs the following

  • Opens connection to a webservice URL
  • Passes through XML request
  • Reads XML response from webservice

Note this example relies on a Literal ‘ltlOut’ being present to spit the response into.

I have added it here so I can find this example again if required
Read more »

Tags: , , , , ,