|
-
Aug 20th, 2006, 10:32 AM
#1
[1.0/1.1] what does these attributes mean??
hello,
i tried an example of type initializer (static constructors), and when i looked up the IL code, it used some attributes like HidbySig, specialname, rtspecialname and named it as .cctor.
what do these 4 things imply??
thank you.
Last edited by Harsh Gupta; Aug 20th, 2006 at 02:35 PM.
Reason: improving the question and subject
-
Aug 20th, 2006, 10:59 AM
#2
Hyperactive Member
Re: [1.0/1.1] what does .cctor means??
hmmm. I don't think i've ever tried to understand any IL, but if your interested in it, they have some books on amazon.com.
-
Aug 20th, 2006, 11:16 AM
#3
Re: [1.0/1.1] what does .cctor means??
.cctor is short for "Constructor".
IL is an advanced topic. You are wasting your time looking at it if you don't understand C# first.
I don't live here any more.
-
Aug 20th, 2006, 02:33 PM
#4
Re: [1.0/1.1] what does .cctor means??
i know C#, there were few things like Un/Boxing which could be understand using IL. I am not much into IL thing, this time I used a static constructor so did it out of curiosity.
BTW, Constructor is .ctor!! .cctor is Static Constructor. just tried this code to confirm
Code:
using System;
using System.Reflection;
class Test
{
static Test() { }
public Test(int i) { }
public Test(string s) { }
}
class Demo
{
static void Main()
{
Type[] paramtypes = new Type[0];
ConstructorInfo ctor = typeof(Test).GetConstructor(
BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null,
CallingConventions.Standard, paramtypes, null);
ConstructorInfo[] c = typeof(Test).GetConstructors(BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
Console.WriteLine("ctortype: Attribs\n");
foreach (ConstructorInfo c1 in c)
{
Console.WriteLine("{0}\t: {1}", c1.Name, c1.Attributes);
}
Console.ReadLine();
}
}
as for HidBySig, got this:
'hidebysig' attribute only hides base class methods with the same name if they also have the same sigature (return type and parameter types).
though i could not get the exact picture of its necessity.
-
Aug 23rd, 2006, 08:40 AM
#5
Re: [1.0/1.1] what does these attributes mean??

:bump:
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|