Click here to Skip to main content
15,886,518 members
Home / Discussions / C#
   

C#

 
AnswerRe: Opening .xls file in Excel from C# Pin
Ed.Poore11-May-08 9:46
Ed.Poore11-May-08 9:46 
AnswerRe: Opening .xls file in Excel from C# Pin
Jimmanuel11-May-08 15:05
Jimmanuel11-May-08 15:05 
QuestionSystem Error mgs and flickering issue.... Pin
ASysSolvers11-May-08 3:03
ASysSolvers11-May-08 3:03 
Questiongenerics question Pin
George_George10-May-08 22:35
George_George10-May-08 22:35 
AnswerRe: generics question Pin
carbon_golem11-May-08 7:25
carbon_golem11-May-08 7:25 
GeneralRe: generics question Pin
George_George11-May-08 15:18
George_George11-May-08 15:18 
GeneralRe: generics question Pin
S. Senthil Kumar11-May-08 19:31
S. Senthil Kumar11-May-08 19:31 
GeneralRe: generics question Pin
George_George11-May-08 21:45
George_George11-May-08 21:45 
Thanks Senthil,


1.

S. Senthil Kumar wrote:
The statement that you mentioned means that you can't have generic generic type parameters - unlike C++, which allows template template types as template parameters.


The following code, which use generics type as generics type type parameter can compile. Seems violates the above rule. Any comments?

using System;
using System.Collections.Generic;

class Test
{
    static void Main()
    {
        Generic<Generic2<List<int>>> gen = new Generic<Generic2<List<int>>>();
    }

}

class Generic<T>
{
    List<T> list1 = new List<T>();
    List<int> list2 = new List<int>();
    List<Generic2<T>> gen1 = new List<Generic2<T>>();
    List<Generic2<int>> gen2 = new List<Generic2<int>>();
}

class Generic2<U>
{
}


2.

S. Senthil Kumar wrote:
In .NET, the generic type can be part of a different assembly from the code attempting to use it,


What does it mean? Means a genetics type defined in one assembly, but used/referred from another assembly? So, C# can do binary level (IL) reference, but C++ could only do source code level (header file) reference?

3.

"Therefore, the C# compiler forces you to declare constraints" -- we can define a generics type without defining any constraints, right?

In what situations, do we have to define constraints when define a generics type?


regards,
George
GeneralRe: generics question Pin
S. Senthil Kumar11-May-08 22:45
S. Senthil Kumar11-May-08 22:45 
GeneralRe: generics question Pin
George_George11-May-08 23:06
George_George11-May-08 23:06 
GeneralRe: generics question Pin
S. Senthil Kumar11-May-08 23:59
S. Senthil Kumar11-May-08 23:59 
GeneralRe: generics question Pin
George_George12-May-08 1:28
George_George12-May-08 1:28 
GeneralRe: generics question Pin
S. Senthil Kumar12-May-08 2:17
S. Senthil Kumar12-May-08 2:17 
GeneralRe: generics question Pin
George_George12-May-08 2:32
George_George12-May-08 2:32 
QuestionFile header processing... [modified] Pin
natsuyaki10-May-08 22:00
natsuyaki10-May-08 22:00 
AnswerRe: File header processing... Pin
DanB198310-May-08 23:14
DanB198310-May-08 23:14 
GeneralRe: File header processing... Pin
natsuyaki10-May-08 23:34
natsuyaki10-May-08 23:34 
GeneralRe: File header processing... Pin
DanB198310-May-08 23:52
DanB198310-May-08 23:52 
GeneralRe: File header processing... Pin
natsuyaki10-May-08 23:59
natsuyaki10-May-08 23:59 
AnswerRe: File header processing... Pin
boblaw9911-May-08 4:13
boblaw9911-May-08 4:13 
GeneralRe: File header processing... Pin
natsuyaki11-May-08 4:24
natsuyaki11-May-08 4:24 
AnswerRe: File header processing... Pin
boblaw9911-May-08 5:03
boblaw9911-May-08 5:03 
GeneralRe: File header processing... Pin
natsuyaki11-May-08 5:16
natsuyaki11-May-08 5:16 
AnswerRe: File header processing... Pin
boblaw9911-May-08 5:22
boblaw9911-May-08 5:22 
GeneralRe: File header processing... Pin
natsuyaki11-May-08 5:34
natsuyaki11-May-08 5:34 

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.