473,378 Members | 1,394 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,378 software developers and data experts.

Manged Code Issues??

al
Hi,

I'm very confused about the following:
Can someone please explain the difference between Type and Strong
Typed Data and if there is untyped data in the Managed Code, and how
this relates to earyl and latte bindings? Also, what is the
defference between close and dispose and how they relate to Finalize
argument?

MTIA,
Grawsha
Nov 20 '05 #1
1 895
"al" <gr*********@yahoo.com> wrote in message
news:66**************************@posting.google.c om...
Hi,

I'm very confused about the following:
Can someone please explain the difference between Type and Strong
Typed Data
Type = data type, whether it's a primative type, value type, structure, or
reference type (class).
The data isn't necessarily strongly typed. The code is strongly typed.
Strongly typed code avoids implicit data type conversion and requires type
definition for all variables/references.
and if there is untyped data in the Managed Code,
All data is typed, however if what you mean is a loose generic type (like
Variant from VB6) then you can use the "object" type.
Some .NET languages allow you to compile code that isn't strongly typed,
others don't.
and how
this relates to earyl and latte bindings?
Early binding occurs when the compiler knows the interface ahead of time.
Late binding occurs when the compiler has no idea about the interface ahead
of time.

If I write
Dim X As MyClass
X = New MyClass

then call a method using that reference, like
X.GetTotalRevenue(Months.January)

the compiler knows that the GetTotalRevenue method exists on the MyClass
interface, and can call the code directly. This is early binding. However,
if I write this instead:
Dim X As Object
X = New MyClass

then call the same method:
X.GetTotalRevenue(Months.January)
the compiler has no idea that the "object" instance will have a
GetTotalRevenue method when this code runs. It has to inspect the object and
make sure that the object supports the method AND supports a method that has
the right number and type of parameters provided (or can be converted to
such), then invokes the method by using reflection. This is late binding,
and it is significantly slower.
Also, what is the
defference between close and dispose and how they relate to Finalize
argument?
If it sounds like it makes sense to have a Close method on a class (like it
makes sense to close a Stream or a Connection), then you typically code a
Close method. It basically does the same thing as Dispose in most cases.
Finalize is called when the Garbage Collector is about to wipe out the
object data from memory. It is the last chance for the object to see if it
hasn't be properly disposed, and call the clean-up code if needed. If a
class supports Dispose or Close, and Dispose or Close was already called,
then Finalize should ignore the clean-up. Managed data doesn't need to be
manually cleaned up, but if managed code is using unmanaged data internally
(like various window API handles), then the class using these unmanaged
resource must provide a Dispose/Close method, and must do a final check for
clean-up of these unmanaged resources in Finalize.

-Rob Teixeira [MVP]
MTIA,
Grawsha

Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Sai Kit Tong | last post by:
I posted for help on legacy code interface 2 days ago. Probably I didn't make it clear in my original mail. I got a couple of answers but none of them address my issues directly (See attached...
2
by: Manish | last post by:
Hi, I m facing a problem in re-writing a code from VB to C #. We are using a third party DLL to develop a application of Fax. The current application is already written in VB and we have to...
3
by: Germic | last post by:
Hi, I want to create an Hashtable in C# and pass an pointer to the hashtable to a C code. Later, the C code could reference the hashtable by passing the pointer to the hashtable as a ref...
0
by: P Reddy | last post by:
Hi All, Greetings!!! I have a question. Please respond.... I am trying to write a C# component that need to inherit some of the the interfaces from unmanged code(VC). I think one way to...
2
by: MR | last post by:
help! I have an unmanaged DLL that I do not have the source code, so i can't recompile or make changes. the DLL requires a callback function. I would like to implement the callback method in a...
4
by: gabe | last post by:
i have a solution to gather the text in each window that is open, but would rather use only managed code rather than unmanaged code my current solution relies on. The purpose is to get the text in...
0
by: HeroOfSpielburg | last post by:
Hello, I'm new to the realm of .NET application creation, so please forgive my ignorance. I have been tasked with debugging a problem that arises with using a DLL that contains managed and...
2
by: Cartoper | last post by:
I am working in VS2005 (.Net 2.0). I have a unmanaged C++ class that will be used by C#, once I get to that point. I would like to throw a System::ApplicationException from the unmanaged code,...
4
by: Newbie19 | last post by:
I've searched a few websites and none of them meantion how to break up really long lines of code like a sql query. The sql statement looks like this (I've broked it down so it can fit in the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.