Generic type checking

前端 未结 8 1420
既然无缘
既然无缘 2020-12-22 17:10

Is there a way to enforce/limit the types that are passed to primitives? (bool, int, string, etc.)

Now, I know you can limit the generic typ

8条回答
  •  粉色の甜心
    2020-12-22 17:39

    You can simplify the EnforcePrimitiveType method by using typeof(PrimitiveDataType).IsPrimitive property. Am I missing something?

提交回复
热议问题