Results 1 to 5 of 5

Thread: [1.0/1.1] what does these attributes mean??

  1. #1

    Thread Starter
    Smitten by reality Harsh Gupta's Avatar
    Join Date
    Feb 2005
    Posts
    2,938

    [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

  2. #2
    Hyperactive Member francisstokes's Avatar
    Join Date
    May 2005
    Location
    Kent, England
    Posts
    272

    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.

  3. #3
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    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.

  4. #4

    Thread Starter
    Smitten by reality Harsh Gupta's Avatar
    Join Date
    Feb 2005
    Posts
    2,938

    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.
    Show Appreciation. Rate Posts.

  5. #5

    Thread Starter
    Smitten by reality Harsh Gupta's Avatar
    Join Date
    Feb 2005
    Posts
    2,938

    Re: [1.0/1.1] what does these attributes mean??


    :bump:
    Show Appreciation. Rate Posts.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width