我应该怎么用“我的"?VB .NET 中的命名空间? [英] What should I use the "My" namespace for in VB .NET?

查看:14
本文介绍了我应该怎么用“我的"?VB .NET 中的命名空间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在考虑为 VB.NET 构建一个框架,使用 My 命名空间将其插入 VB 似乎是一个合理的想法.什么是我的"?用于?

I'm considering building a framework for VB.NET, and using the My namespace to plug it into VB seems like a reasonable idea. What is "My" used for?

推荐答案

据我所知,My 的目的是成为某些 API 任务的简单快捷方式,这些任务是常见但难以找到或难以实现的-用.您可能不应该将您的框架完全包含在 My 下.(一方面,使用您的框架的 C# 人员可能会生气.)

The purpose of My, as I understand it, is to be an easy shortcut to certain API tasks that are common but hard-to-find or hard-to-use. You probably shouldn't completely subsume your framework under My. (For one thing, C# people using your framework may get grouchy.)

相反,您应该将其设计为普通框架.完成后,列出一些人们可能希望使用您的框架执行的常见任务.看看在 My 下是否有任何有用的东西,尤其是在有可以以多种方式使用的类或方法的情况下,但它们有一两个真正常见的用法可以缩写为 My.

Instead, you should design it as a normal framework. When you're finished, make a list of some common tasks that people might want to use your framework for. See whether any of those could be useful to have under My, especially where there are classes or methods that can be used in a number of ways, but they have one or two really common usages that can be abbreviated with My.

本文展示了如何扩展 My,并在最后一节介绍了一些需要遵循的设计准则:通过自定义我的命名空间来简化常见任务

This article shows how to extend My, and it has a section at the end that describes a few design guidelines to follow: Simplify Common Tasks by Customizing the My Namespace

至于您的主要问题,在 VB .NET 中编码时,我尽可能经常使用 My.它将许多操作减少到一行代码.

As to your main question, when coding in VB .NET, I use My as often as I can. It reduces a number of operations to one line of code.

这篇关于我应该怎么用“我的"?VB .NET 中的命名空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆