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 / .NET Framework / Remoting / July 2006

Tip: Looking for answers? Try searching our database.

What's Diffrence between tyoeof()  and Type.GetType() ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lawrence Chang - 08 Jun 2005 04:01 GMT
Hi My Friends,

In  WellKnownServiceTypeEntry WKSTE = new
WellKnownServiceTypeEntry(typeof(ServiceClass),"HttpService",
WellKnownObjectMode.SingleCall);

I use typeof(ServiceClass) and it works.  I used Type.GetType( "ServiceClass
"),  it doesn't work. I checked the document of typeof() and Type.GetType(),
I could not find out the diffrentce. Would you like to tell me ?

Regards,

Larry
Sean Hederman - 08 Jun 2005 06:06 GMT
> Hi My Friends,
>
[quoted text clipped - 6 lines]
> Type.GetType(), I could not find out the diffrentce. Would you like to
> tell me ?

Well the fact that one takes a static type reference and the other a type
name would be a start. Type.GetType is evaluated at runtime, whilst typeof
is evaluated at compile time. Type.GetType should be passed in a qualified
name rather than a partial name as this will make it easier for it to
resolve the type (e.g. Type.GetType("MyNamespace.MyClass, MyAssembly")).

And another difference would be that Type.GetType is part of the CLR
Framework whilst typeof is a C# keyword.
laurence chang - 09 Jun 2005 15:31 GMT
Hello Sean Hederman

Thank you very much for your help.
I tried use qualified name of the type.
Type.GetType("RemoteAccessComponents.FlightBookings",true);

It seems Type.GetType can only get type from current assembly, even I
add refrence to another assembly, it still can not return the type. but
typeof can do it.

Laurence
Sean Hederman - 10 Jun 2005 05:42 GMT
> Hello Sean Hederman
>
> Thank you very much for your help.
> I tried use qualified name of the type.
> Type.GetType("RemoteAccessComponents.FlightBookings",true);

Lawrence, that is not a qualified name, that's a partial name. A qualified
name includes the name of the assembly after a comma, so if your type is
FlightBookings and the namespace it is in is RemoteAccessComponents and the
assembly it is in is RACAssembly you'd use:
Type.GetType("RemoteAccessComponents.FlightBookings, RACAssembly");
champak mehta - 24 Jul 2006 15:46 GMT
because you are stupid

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.