473,387 Members | 1,619 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

gettype is not working for interface

1
pls help me it urgent

i m facing a problem with my vb.net code
this is the code equivalent in c#
this is the interface........
.................................................. .................................................. ...........
namespace x
{.
public interface ISection
{
string UserControl
{
get;
}

string SectionId
{
get;
}

bool Delete();

void SaveData();

List<SearchResult> Search(string searchString, WebPage page);
}
.................................................. .................................................. ............
and in a another class file i use this interface isection like this
namespace x
{
public class Sidebar
...................................
...............
public static bool GetSectionRss(XmlWriter rss, ISection section, string pageId, string TitlePrefix)
{
if (section != null)
{
ChannelData SectionChannel = ((ISidebarObject)section).GetSidebarRss(pageId);

string TypeName = section.GetType().ToString();
.................................................. .............
............................................
}}}


it is working in C#
but when i chane the code into vb.net
i m getting a error message in


dim TypeName as string =section.[gettype]().Tostring()


i tried to use dim TypeName as string =section.gettype()

but i cannot type like .......
later i know that type of a interface cannot getthrough GetType()

but i want to get the type of that interface................
pls help me ,tell me another method for it.

thanks in advance.....................
Dec 29 '08 #1
2 3474
MrMancunian
569 Expert 512MB
Post your VB.NET code so we can check it out...

Steven
Dec 29 '08 #2
Frinavale
9,735 Expert Mod 8TB
There's a GetType method in VB.NET that retrieves a Type Object containing information for an Object/Structure. Once you have the Type object you can retrieve the name, properties, methods...etc etc

The following example demonstrates how to retrieve the Name:
Expand|Select|Wrap|Line Numbers
  1. Dim theType as Type = GetType(section)
  2. Dim theName as String = theType.Name
Dec 30 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Jim Bancroft | last post by:
Hi everyone, I'm having some trouble with the code below. I receive a compile-time error on the second line saying "; expected": private static void myTestFunction(long myLong) { ...
2
by: Razzerroo | last post by:
Still on my quest to convert my company's VB.NET code to C#. Here's the line I need to convert VB.NET System.Runtime.Remoting.RemotingServices.Connect(GetType(ISensor), strURL)) where...
10
by: Bob | last post by:
This has been bugging me for a while now. GetType isn't availble for variables decalred as interface types, I have to DirectCast(somevariable, Object). In example: Sub SomeSub(ByVal...
4
by: Howard Kaikow | last post by:
For the code below, for both appWord and gappWord, I get the error "Public member 'GetType' on type 'ApplicationClass' not found" I realize the test for appWord is superflous as the parameter...
5
by: Grande | last post by:
Hi all, I'm trying to use GetType to get an Interface, but it's not working? Is there a special way you have to do this, since it's an Interface (rather than a complete class)? Code: Type...
7
by: Sky | last post by:
I have been looking for a more powerful version of GetType(string) that will find the Type no matter what, and will work even if only supplied "{TypeName}", not the full "{TypeName},{AssemblyName}"...
0
by: Flack | last post by:
Hey guys, Here is my scenario: I have a form and two dlls, call them ClassLibrary1.dll and Interfaces.dll. In my form I have the following: private Assembly m_assembly; private Type m_type;...
4
by: Steph | last post by:
hello, i want to find the type from a generic... like : public static john<T>(object obj, T myControl) { ((myControl.getType())myControl).OnClientClick ="code"; } because my generic var can...
0
by: svwi | last post by:
Hi. I need to dynamically retreive the type name of a COM-object exposed by a C# COM server. This was previously successfully done in .NET framwork 1.X with the method "GetType()", inherited...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.