diff options
author | Daniel Grunwald <daniel@danielgrunwald.de> | 2010-10-11 21:17:23 +0400 |
---|---|---|
committer | Daniel Grunwald <daniel@danielgrunwald.de> | 2010-10-11 21:17:23 +0400 |
commit | 2634564ad227fa9abc185e26ce792464f5350127 (patch) | |
tree | 560ea6bfe78ad4309dba60246a39ca6fefd3ea77 /README | |
parent | 24e7c50e328831761bbbe1a1c863513abfceebf5 (diff) |
Rename Util to Utils; added replaced "object CacheToken" with "CacheManager CacheManager"
Diffstat (limited to 'README')
-rw-r--r-- | README | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -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. |