Results 1 to 5 of 5

Thread: Programming Question

  1. #1
    Neanderthal Dwood's Avatar
    Join Date
    Sep 2008
    Location
    Wouldn't u like to know?
    Posts
    4,189

    Code Programming Question

    When I see SomeText<T> in a programming file, what am I looking at? What's it called when a programmer does that? I'm looking for more info but I don't see any data on it from any of my Googling.

    Edit:

    Code:
            public static TResult SafeInvoke<T, TResult>(this T isi, Func<T, TResult> call) where T : ISynchronizeInvoke
            {
                if (isi.InvokeRequired) { 
                    IAsyncResult result = isi.BeginInvoke(call, new object[] { isi }); 
                    object endResult = isi.EndInvoke(result); return (TResult)endResult; 
                }
                else
                    return call(isi);
            }
    For example, in the above C# code, what's going on? Or rather, what terms describe this?
    Last edited by Dwood; February 28th, 2015 at 03:29 PM.
    Reply With Quote

  2. #2

    Re: Programming Question

    In C++ it's called template. However your code example is in C#, it seems to be named as generics. Found it from this link. I have used templates often in my project, sometimes for multi-thread safe class/variables whenever I need it across another thread to be used. Hope this is helpful for quick look up myself, plus Std library, for good example "std vector", also used this too.

    P.S. In native C language, it is not supportive.
    Reply With Quote

  3. #3
    Neanderthal Dwood's Avatar
    Join Date
    Sep 2008
    Location
    Wouldn't u like to know?
    Posts
    4,189

    Re: Programming Question

    Thanks!
    Reply With Quote

  4. #4

    Re: Programming Question

    Np
    Reply With Quote

  5. #5

    Re: Programming Question

    In native C, it is not supportive.
    Reply With Quote

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •