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

What do lines like [COMImport] do?

SM
I found a COM interop code sample and came across these lines of code:

[ComImport]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown )]
[Guid("FC4801A3-2BA9-11CF-A229-00AA003D7352")]

What do those type of lines encapsuled in [] brackets do? I already tried
to find an answer using web search but no success. :(

Thanks for any help.


--
if you want to contact me, add "news.speakto." in front of my email adress.
Nov 15 '05 #1
1 8095
These are so called attributes. They usually emit metadata about a class, a
class member or an assembly which is then used by the JIT compiler, CLR or
even in other parts of the program. In your particular example, the
attributes instruct the runtime to forward calls to the class they apply to
to a COM object with the specified GUID and interface type.

P.S. You should consult MSDN on topics such as ComImportAttribute,
GuidAttribute and InterfaceTypeAttribute to find out their *exact* meaning
as my response is rather generic.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://www.x-unity.net/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"SM" <ta****@spamgourmet.com> wrote in message
news:r9*****************************@40tude.net...
I found a COM interop code sample and came across these lines of code:

[ComImport]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown )]
[Guid("FC4801A3-2BA9-11CF-A229-00AA003D7352")]

What do those type of lines encapsuled in [] brackets do? I already tried
to find an answer using web search but no success. :(

Thanks for any help.


--
if you want to contact me, add "news.speakto." in front of my email

adress.

Nov 15 '05 #2

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

Similar topics

10
by: ross | last post by:
I want to do some tricky text file manipulation on many files, but have only a little programming knowledge. What are the ideal languages for the following examples? 1. Starting from a certain...
5
by: Ali Eghtebas | last post by:
Hi, I've made this regex to catch the start of a valid multiline comment such as "/*" in e.g. T-SQL code. "(?<=^(?:*'*')*?*)(?<!^(?:*'*')*?--.*)/\*.*?$" With Multiline option on. As we know...
34
by: Ross Reyes | last post by:
HI - Sorry for maybe a too simple a question but I googled and also checked my reference O'Reilly Learning Python book and I did not find a satisfactory answer. When I use readlines, what...
14
by: mesterak | last post by:
I want to very quickly count the number of lines in text files without having to read each line and increment a counter. I am working in VB.NET and C#. Does anyone have a very fast example on how...
3
by: Bob S | last post by:
A class in assembly A implements a COM interface as follows : internal interface IMyInterface { int MyMethod(); } class MyClass : IMyInterface
3
by: CCLeasing | last post by:
Hi i'm trying to check if the last line in a file is equal to a string i'm comparing it with. I have the general idea of what I should be doing. Could someone take a look at the following and...
9
by: Chad | last post by:
This might be a bit vague and poorly worded..... In my program, I handle function failures using fprintf() and exit() like: fprintf(stderr, "malloc failed"); exit(EXIT_FAILURE); There...
89
by: Tubular Technician | last post by:
Hello, World! Reading this group for some time I came to the conclusion that people here are split into several fractions regarding size_t, including, but not limited to, * size_t is the...
53
by: Gianni Mariani | last post by:
Do you have a preference on maximum line width for C++ code? I've seen the craziest debates on this most silly of topic. I have witnessed engineers spent oodles of time fiddling with line...
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...
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.