1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
5
using System.Collections.Generic;
7
namespace ICSharpCode.SharpDevelop.Dom
10
/// Interface for reference to types (classes).
11
/// Such a reference can be direct (DefaultReturnType), lazy (SearchClassReturnType) or
12
/// returns types that stand for special references (e.g. ArrayReturnType)
14
public interface IReturnType : IEquatable<IReturnType>
17
/// Gets the fully qualified name of the class the return type is pointing to.
20
/// "System.Int32" for int[]<br/>
21
/// "System.Collections.Generic.List" for List<string>
23
string FullyQualifiedName {
28
/// Gets the short name of the class the return type is pointing to.
31
/// "Int32" or "int" (depending how the return type was created) for int[]<br/>
32
/// "List" for List<string>
39
/// Gets the namespace of the class the return type is pointing to.
42
/// "System" for int[]<br/>
43
/// "System.Collections.Generic" for List<string>
50
/// Gets the full dotnet name of the return type. The DotnetName is used for the
51
/// documentation tags.
54
/// "System.Int[]" for int[]<br/>
55
/// "System.Collections.Generic.List{System.String}" for List<string>
62
/// Gets the number of type parameters the target class should have
63
/// / the number of type arguments specified by this type reference.
65
int TypeArgumentCount {
70
/// Gets the underlying class of this return type. This method will return <c>null</c> for
71
/// generic return types and types that cannot be resolved.
73
IClass GetUnderlyingClass();
76
/// Gets all methods that can be called on this return type.
78
List<IMethod> GetMethods();
81
/// Gets all properties that can be called on this return type.
83
List<IProperty> GetProperties();
86
/// Gets all fields that can be called on this return type.
88
List<IField> GetFields();
91
/// Gets all events that can be called on this return type.
93
List<IEvent> GetEvents();
97
/// Gets if the return type is a default type, i.e. no array, generic etc.
100
/// True for SearchClassReturnType, GetClassReturnType and DefaultReturnType.<br/>
101
/// False for ArrayReturnType, SpecificReturnType etc.
103
bool IsDefaultReturnType { get; }
106
/// Gets if the cast to the specified decorating return type would be valid.
108
bool IsDecoratingReturnType<T>() where T : DecoratingReturnType;
111
/// Casts this return type to the decorating return type specified as type parameter.
112
/// This methods casts correctly even when the return type is wrapped by a ProxyReturnType.
113
/// When the cast is invalid, <c>null</c> is returned.
115
T CastToDecoratingReturnType<T>() where T : DecoratingReturnType;
117
bool IsArrayReturnType { get; }
118
ArrayReturnType CastToArrayReturnType();
120
bool IsGenericReturnType { get; }
121
GenericReturnType CastToGenericReturnType();
123
bool IsConstructedReturnType { get; }
124
ConstructedReturnType CastToConstructedReturnType();
127
/// Gets whether the type is a reference type or value type.
130
/// true, if the type is a reference type.
131
/// false, if the type is a value type.
132
/// null, if the type is not known (e.g. generic type argument or type not found)
134
bool? IsReferenceType { get; }
137
/// Gets an identical return type that binds directly to the underlying class, so
138
/// that repeatedly calling methods does not cause repeated class lookups.
139
/// The direct return type will always point to the old version of the class, so don't
140
/// store direct return types!
142
/// <returns>This method never returns null.</returns>
143
IReturnType GetDirectReturnType();