Reputation: 119
My web service is returning
List<Term_Tree>
via web method. The Term_Tree class is defined as below
public class Term_Tree
{
public string ID;
public string Name;
public List<Item> BroaderTerms;
public List<Item> NarrowerTerms;
}
My preferred name for this class is "Term" (i.e. i want to return List<Term>
via web method)
but there is another class with the name "Term" and is widely used in the code. Is it possible to give this class some sort of alias to return List<Term>
Upvotes: 0
Views: 658
Reputation: 25076
Use a using directive, something like (using a test namespace):
using Term = My.Very.Easy.NameSpace.Term_Tree;
Which would become:
List<Term> list = new List<Term>();
Upvotes: 1
Reputation: 56449
You'd have to add a using
alias in order to distinguish, something like:
using Term = YourNameSpace.Term_Tree;
BUT, if you use your other Term
class in the same file, you'd have to prefix that one with it's namespace, otherwise you'd get ambiguous reference errors
Upvotes: 1