.NET CLR sql 标量函数数据类型

发布于 2024-10-05 19:58:55 字数 586 浏览 0 评论 0原文

简而言之:我编写了一个 CLR 函数,它以复杂的方式处理 2 个字符串

我的困境:SqlStringstring。我在 MSDN 上读到,区别在于字符串始终从当前线程获取 CurrentCulture

但我希望能够分割输入字符串:string.Split()等。

我应该将SqlString作为参数类型,然后将其转换为字符串? (我看到它有一个显式运算符)。如果这样的话,不影响演出吗? (重要的)。或者我应该直接将 string 作为输入。?

无论如何,SqlString 具有 .Value 属性,它是 string 类型。如果我采用这个值,当我“不使用它”时,将 SqlString 作为参数类型有什么意义?

public static bool Foo(SqlString s, SqlString t) {}

Briefly: I've written a CLR function that processes 2 strings in a complex way.

My dilema: SqlString vs string. I read on MSDN that the difference is that string takes always the CurrentCulture from the current Thread.

But I want to be able to split the input strings: string.Split(), etc..

Should I have SqlString as parameter type and then convert it to string? (I saw that it has an explicit operator). If so, won't it hit the performance? (important). Or should I take directly string as the input.?

Anyways, the SqlString has .Value Property which is a string type. If I take this value, what is the sense of having SqlString as parameter types when I'm 'not using it' ?

public static bool Foo(SqlString s, SqlString t) {}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

∞觅青森が 2024-10-12 19:58:55

SqlString 具有来自其他 sql 类型的转换运算符。尝试使用它并传递来自其他类型(int、bigint 等)的 sql 变量。

SqlString have conversion operators from others sql types. Try to use it and pass sql vars from other types (int, bigint, etc...).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文