开发者

CLS compat Public properties naming validation routine

开发者 https://www.devze.com 2023-02-13 07:20 出处:网络
Im working on a system that allows one to define data types (types that have only public properties) on the fly (undercovers using reflection.emit), i want my new types to also be CLS compliant, what

Im working on a system that allows one to define data types (types that have only public properties) on the fly (undercovers using reflection.emit), i want my new types to also be CLS compliant, what would a validat开发者_StackOverflow社区or that validates member names need to take into account in order to be CLS compliant, im only interested in what a function would validate in order to determine if the entered name is ok..

something like

bool IsValidMemberName(string name)
{
  ...
}


Have a look here for the rules: Why is this name with an underscore not CLS Compliant?. Now you simply need to build a regex that checks for those rules. Shouldn't be too hard.

0

精彩评论

暂无评论...
验证码 换一张
取 消