Click here to Skip to main content
15,884,388 members
Home / Discussions / C#
   

C#

 
AnswerRe: Transfer a txt file Pin
harold aptroot25-Feb-09 12:54
harold aptroot25-Feb-09 12:54 
AnswerRe: Transfer a txt file Pin
Luc Pattyn25-Feb-09 13:15
sitebuilderLuc Pattyn25-Feb-09 13:15 
AnswerRe: Transfer a txt file [modified] Pin
Megidolaon25-Feb-09 21:59
Megidolaon25-Feb-09 21:59 
QuestionRTF Fields have a gap between them when placed against each other. Pin
Ryan Esteves25-Feb-09 9:47
professionalRyan Esteves25-Feb-09 9:47 
GeneralRe: RTF Fields have a gap between them when placed against each other. Pin
Lodeclaw25-Feb-09 12:30
Lodeclaw25-Feb-09 12:30 
GeneralRe: RTF Fields have a gap between them when placed against each other. Pin
Ryan Esteves26-Feb-09 4:19
professionalRyan Esteves26-Feb-09 4:19 
AnswerRe: RTF Fields have a gap between them when placed against each other. Pin
Ryan Esteves3-Mar-09 6:00
professionalRyan Esteves3-Mar-09 6:00 
QuestionDynamically passing a variable list of parameters to a Generic delegate? Pin
Steve Holdorf25-Feb-09 9:32
Steve Holdorf25-Feb-09 9:32 
I am creating a Cache Manager that will call a GetCacheItem method to get either a DataTable in cache or if the DataTable is not in cache the GetCacheItem method will make the SQL database call and then put the returned DataTable into cache. The parameters I want to pass to the GetCacheItem method are the cache item key and a delegate of type Func<tresult> with a delegate name of QueryExpression. The problem is that I want the Func<t> QueryExpression delegate to be used by several SQL select statments each with a different number of query parameters. How can I implement the Func<t> delegate to be able to take a different number of parameters each time it is called? Below is an example of what I have so far:

        public object GetCacheItem(String sCacheKey, Func<object> QueryExpression)
        {
            object objCacheItem = null;

            if (!CachingEnabled)
            {
                return objCacheItem;
            }

            if (CacheItem<object>(sCacheKey) != null)
            {
                return CacheItem<object>(sCacheKey);
            }
            else
            {
                lock (syncObject)
                {
                    if (CacheItem<object>(sCacheKey) != null)
                    {
                        return CacheItem<object>(sCacheKey);
                    }
                    else
                    {
// Different number of SQL parameters each time called by QueryExpression(?) 
                        Object cacheItem = QueryExpression();
                        AddToCache<object>(sCacheKey, cacheItem);

                        return cacheItem;
                    }
                }
            }
        }

</object></object></object></object></object></object>


NOTE: As you can see my Func<t> delegate only has a return argument and not the list of variable parameters. What do I need to do?

Thanks,


Steve
QuestionRe: Dynamically passing a variable list of parameters to a Generic delegate? Pin
Steve Holdorf25-Feb-09 10:16
Steve Holdorf25-Feb-09 10:16 
Questionwill firewall bolck the tcp listner ? Pin
Mubeen.asim25-Feb-09 8:40
Mubeen.asim25-Feb-09 8:40 
AnswerRe: will firewall bolck the tcp listner ? Pin
Christian Graus25-Feb-09 9:09
protectorChristian Graus25-Feb-09 9:09 
GeneralRe: will firewall bolck the tcp listner ? Pin
Mubeen.asim25-Feb-09 9:12
Mubeen.asim25-Feb-09 9:12 
GeneralRe: will firewall bolck the tcp listner ? Pin
EliottA25-Feb-09 10:36
EliottA25-Feb-09 10:36 
QuestionConverting grid values to lower case for update Pin
alwaysgull25-Feb-09 8:26
alwaysgull25-Feb-09 8:26 
QuestionConverting grid values to lower case for update Pin
alwaysgull25-Feb-09 8:09
alwaysgull25-Feb-09 8:09 
AnswerRe: Converting grid values to lower case for update Pin
Rutvik Dave25-Feb-09 8:36
professionalRutvik Dave25-Feb-09 8:36 
GeneralRe: Converting grid values to lower case for update Pin
alwaysgull25-Feb-09 11:18
alwaysgull25-Feb-09 11:18 
AnswerRe: Converting grid values to lower case for update Pin
Wendelius25-Feb-09 8:44
mentorWendelius25-Feb-09 8:44 
QuestionGet Recycle Bin icon Pin
Nitoc325-Feb-09 8:09
Nitoc325-Feb-09 8:09 
AnswerRe: Get Recycle Bin icon Pin
Giorgi Dalakishvili25-Feb-09 8:41
mentorGiorgi Dalakishvili25-Feb-09 8:41 
QuestionTableLayoutPanel Cell Pin
Muammar©25-Feb-09 7:37
Muammar©25-Feb-09 7:37 
AnswerRe: TableLayoutPanel Cell Pin
Rutvik Dave25-Feb-09 8:27
professionalRutvik Dave25-Feb-09 8:27 
QuestionDrawImageUnscaled not working Pin
Richard Blythe25-Feb-09 6:43
Richard Blythe25-Feb-09 6:43 
AnswerRe: DrawImageUnscaled not working Pin
Luc Pattyn25-Feb-09 8:24
sitebuilderLuc Pattyn25-Feb-09 8:24 
QuestionForm Key Down Even not activated? Pin
Muammar©25-Feb-09 6:36
Muammar©25-Feb-09 6:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.