Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / January 2008

Tip: Looking for answers? Try searching our database.

C # Generics

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Elliott810 - 22 Jan 2008 19:02 GMT
I have to be honest I haven't used many generics in my coding; I
really want to start using more of them but  am having trouble with
what is the best way to use a generic with my Send method because the
Send method needs to point to different data factories. I really would
like to hear some suggestions.

using System;
using System.Collections;
using System.Data.SqlClient;
using Microsoft.SqlServer.Server;
using System.Xml;

namespace PartsNow.Site.Database.Data
{
   public class Groups
   {
       #region Fields
       ArrayList m_items = new ArrayList();
       #endregion

       #region Properties
       public virtual Group this[int index]
       {
           get
           {
               return (Group)m_items[index];
           }
       }
       #endregion

       #region Constructors
       public Groups(Group[] objs)
       {
           foreach (Group obj in objs)
           {
               this.List.Add(obj);
           }
       }

       internal Groups(SqlDataReader dbReader)
       {
           while (dbReader.Read())
           {
               m_items.Add(new Group(dbReader));
           }
       }
       #endregion

       #region Methods
       public virtual void Add(Group obj)
       {
           this.List.Add(obj);
       }

       public virtual Group[] ToArray()
       {
           return (Group[])m_items.ToArray(typeof(Group));
       }

       public void Send()
       {
           SqlDataRecord dbRecord = new
SqlDataRecord(Factory.Catalog.MetaData);

           SqlContext.Pipe.SendResultsStart(dbRecord);

           foreach (Catalog catalog in base.List)
           {
               Factory.Catalog.SendResultsRow(catalog, dbRecord);
           }

           SqlContext.Pipe.SendResultsEnd();
       }
       #endregion
   }
}
Brian Muth - 22 Jan 2008 21:53 GMT
I'm sure you will get a better response in a C# newsgroup, rather than a C++ newsgroup. Try reposting in
microsoft.public.dotnet.languages.csharp.

Brian

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.