Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/xamarin/NRefactory.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/README
diff options
context:
space:
mode:
authorDaniel Grunwald <daniel@danielgrunwald.de>2010-10-11 21:17:23 +0400
committerDaniel Grunwald <daniel@danielgrunwald.de>2010-10-11 21:17:23 +0400
commit2634564ad227fa9abc185e26ce792464f5350127 (patch)
tree560ea6bfe78ad4309dba60246a39ca6fefd3ea77 /README
parent24e7c50e328831761bbbe1a1c863513abfceebf5 (diff)
Rename Util to Utils; added replaced "object CacheToken" with "CacheManager CacheManager"
Diffstat (limited to 'README')
-rw-r--r--README15
1 files changed, 15 insertions, 0 deletions
diff --git a/README b/README
index 3a58696e..73587367 100644
--- a/README
+++ b/README
@@ -135,3 +135,18 @@ Q: What format do the .ToString() methods use?
A: They don't use any particular format. They're merely intended as a debugging aid.
Currently .ToString() usually matches .ReflectionName, but that may change in the future.
+
+
+Q: Why are there extension methods IType.IsEnum() and IType.IsDelegate(), but no IType.IsStruct() or IType.IsInterface()?
+
+A: Because if you're asking whether a type is a struct, it's very likely that you're asking the wrong question.
+ The distinction between class/struct/interface/enum/delegate is important in the world of type definitions, and there's
+ ITypeDefinition.ClassType to address this. But the distinction isn't so important in the world of types.
+
+ If whatever you are doing works with struct-types, then it likely will also work with enum-types, and also
+ with type parameters constraint to be a value-type.
+ So instead of asking IsStruct(), you really should be asking: IType.IsReferenceType == false
+
+ Enums and delegates are special because you can do special things with those types (e.g. subtract them from each other).
+ If you really need to know, you can do "type.GetDefinition() != null && type.GetDefinition().ClassType == WhatIWant" yourself,
+ but for the most part you should be fine with IsReferenceType, IsEnum and IsDelegate.