Click here to Skip to main content
15,887,027 members
Home / Discussions / C#
   

C#

 
SuggestionRe: Calculating the area of a self intersecting polygon Pin
Richard MacCutchan18-Mar-14 0:47
mveRichard MacCutchan18-Mar-14 0:47 
QuestionHow to solve a non linear Equation is Visual studio 2012/C# Pin
Nadish Anand17-Mar-14 15:06
Nadish Anand17-Mar-14 15:06 
AnswerRe: How to solve a non linear Equation is Visual studio 2012/C# Pin
Bernhard Hiller17-Mar-14 22:14
Bernhard Hiller17-Mar-14 22:14 
AnswerRe: How to solve a non linear Equation is Visual studio 2012/C# Pin
Matt T Heffron18-Mar-14 8:30
professionalMatt T Heffron18-Mar-14 8:30 
QuestionWhat is used to identify a Generic Type Parameter? Pin
Jörgen Andersson16-Mar-14 10:33
professionalJörgen Andersson16-Mar-14 10:33 
AnswerRe: What is used to identify a Generic Type Parameter? Pin
BillWoodruff16-Mar-14 20:01
professionalBillWoodruff16-Mar-14 20:01 
GeneralRe: What is used to identify a Generic Type Parameter? Pin
Jörgen Andersson16-Mar-14 20:59
professionalJörgen Andersson16-Mar-14 20:59 
GeneralRe: What is used to identify a Generic Type Parameter? Pin
Pete O'Hanlon17-Mar-14 12:06
mvePete O'Hanlon17-Mar-14 12:06 
The clue is in the IL. Consider this assembly:
C#
namespace JorgenQuestion
{
  class Program
  {
    static void Main(string[] args)
    {
      Chooser<ClassA> chooser = new Chooser<ClassA>();
      Chooser<ClassB> chooser2 = new Chooser<ClassB>();
    }
  }

  public class ClassA
  {
  }

  public class ClassB
  {
  }

  public class Chooser<T>
  {
  }
}
Now, the IL that's produced out for the Program class is this:
XML
.class private auto ansi beforefieldinit JorgenQuestion.Program
    extends [mscorlib]System.Object
{
    .method public hidebysig specialname rtspecialname instance void .ctor () cil managed
    {
        IL_0000: ldarg.0
        IL_0001: call instance void [mscorlib]System.Object::.ctor()
        IL_0006: ret
    }

    .method private hidebysig static void Main (
            string[] args
        ) cil managed
    {
        .entrypoint
        .locals init (
            [0] class JorgenQuestion.Chooser`1<class JorgenQuestion.ClassA> chooser,
            [1] class JorgenQuestion.Chooser`1<class JorgenQuestion.ClassB> chooser2
        )

        IL_0000: nop
        IL_0001: newobj instance void class JorgenQuestion.Chooser`1<class JorgenQuestion.ClassA>::.ctor()
        IL_0006: stloc.0
        IL_0007: newobj instance void class JorgenQuestion.Chooser`1<class JorgenQuestion.ClassB>::.ctor()
        IL_000c: stloc.1
        IL_000d: ret
    }
}
As you can see, the newobj statements are instantiating the correct classes.
GeneralRe: What is used to identify a Generic Type Parameter? Pin
BillWoodruff17-Mar-14 18:51
professionalBillWoodruff17-Mar-14 18:51 
GeneralRe: What is used to identify a Generic Type Parameter? Pin
Pete O'Hanlon17-Mar-14 21:15
mvePete O'Hanlon17-Mar-14 21:15 
GeneralRe: What is used to identify a Generic Type Parameter? Pin
Jörgen Andersson17-Mar-14 21:53
professionalJörgen Andersson17-Mar-14 21:53 
GeneralRe: What is used to identify a Generic Type Parameter? Pin
Pete O'Hanlon17-Mar-14 22:42
mvePete O'Hanlon17-Mar-14 22:42 
GeneralRe: What is used to identify a Generic Type Parameter? Pin
Jörgen Andersson17-Mar-14 23:43
professionalJörgen Andersson17-Mar-14 23:43 
GeneralRe: What is used to identify a Generic Type Parameter? Pin
Pete O'Hanlon18-Mar-14 0:50
mvePete O'Hanlon18-Mar-14 0:50 
QuestionAutomapper exception when converting object with inheriting members Pin
impeham16-Mar-14 5:19
impeham16-Mar-14 5:19 
QuestionHow to access Advanced Class with API Pin
Member 1063699816-Mar-14 4:25
Member 1063699816-Mar-14 4:25 
AnswerRe: How to access Advanced Class with API Pin
Dave Kreskowiak16-Mar-14 7:31
mveDave Kreskowiak16-Mar-14 7:31 
GeneralRe: How to access Advanced Class with API Pin
Member 1063699816-Mar-14 9:50
Member 1063699816-Mar-14 9:50 
GeneralRe: How to access Advanced Class with API Pin
Dave Kreskowiak16-Mar-14 14:16
mveDave Kreskowiak16-Mar-14 14:16 
GeneralRe: How to access Advanced Class with API Pin
Member 1063699816-Mar-14 15:56
Member 1063699816-Mar-14 15:56 
QuestionHow create table in SQL Server using C# and data from Excel. Pin
Sick Series15-Mar-14 4:32
Sick Series15-Mar-14 4:32 
AnswerRe: How create table in SQL Server using C# and data from Excel. Pin
OriginalGriff15-Mar-14 4:48
mveOriginalGriff15-Mar-14 4:48 
AnswerRe: How create table in SQL Server using C# and data from Excel. Pin
Maciej Los15-Mar-14 6:43
mveMaciej Los15-Mar-14 6:43 
GeneralRe: How create table in SQL Server using C# and data from Excel. Pin
OriginalGriff16-Mar-14 0:05
mveOriginalGriff16-Mar-14 0:05 
GeneralW:Re: How create table in SQL Server using C# and data from Excel. Pin
Maciej Los16-Mar-14 0:14
mveMaciej Los16-Mar-14 0:14 

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.