Typedef



Hi.

I am looking something similar to typedef in C++ in C#. Basically, I have a
Person class. Then, I want to declare new type called Beneficiary using the
Person class.

I tried using the following:

using System;

namespace X
{
using Beneficiary = Person;
}

The problem with this is that it only works in the file scope. If I want to
use the class in other files, I have to declare them all over again.

I want to declare once in a file and use them other places just like the
other classes.

Thanks.
J
--
Be Cool!
.



Relevant Pages

  • Re: If you could change the C or C++ or Java syntax, what would you like different?
    ... in the way it was done (i.e., refer to the declaration of a new type as "strong typedef"), you ... when you declare a new type the main motivation is to benefit from the need to comply with the ... There would be little desire to create a pointer type which is ... we want implicit conversion rules between ...
    (comp.lang.c)
  • Re: I dont understand typedef example
    ... * Using typedef, declare 'func' to have type ... 'function taking two int arguments, ... declared ptr as a pointer object that can points to a function of the ...
    (comp.lang.c)
  • Re: I dont understand typedef example
    ... Since the only use of such a typedef is to make a type "pointer to ... You *can* use a typedef to declare a function. ... char string1[sizeof STRING1]; ... const unsigned char *p2 = s2; ...
    (comp.lang.c)
  • Re: I dont understand typedef example
    ... Using typedef, declare 'func' to have type ... 'function taking two int arguments, ...
    (comp.lang.c)
  • Re: Simple question on Pointers
    ... typedef char C12; ... As for looking at implementaion before standard, ... It is undefined to use plain old scalar delete on ... hacks) You can't declare a charEVER. ...
    (microsoft.public.vc.language)