&QUOT与......; C#中的等价物 [英] "With" equivalent in C#

查看:61
本文介绍了&QUOT与......; C#中的等价物的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好


对于这个小组和C#编程来说,我都是新手,他花了大约15年左右的时间来编写C和VB。


你会原谅我希望如果我问的是完全明显但是这是一个

的问题,我在文档中找不到答案:


C#中是否有等同于With Me的字样。 VB中的语法;特别是

一些下载的方法可以枚举

表格中可用的对象,而不必记住它们或者不得不去看看那里有什么?


谢谢


Paul BJ

Hello

I am new both to this group and to C# programming having spent the last 15
years or so writing C and VB.

You will forgive I hope if I am asking the totally obvious but it is a
question that I cannot find an answer to in the doc:

Is there an equivalent in C# to the "With Me" syntax in VB; specifically
some means of getting a down-down that enumerates the objects available on a
form instead of having to remember them or having to go look what''s there?

Thanks

Paul BJ

推荐答案

不幸的是,不,我不相信有。在VB的旧时代,每次你削减一个

''时,
可以提供显着的性能提升。''除了可读性之外,它是''主要的吸引力。但是,从我被告知的那个起,我不再是这样了。无论如何,我同意它是一个很好的

构造,但我不相信有一个C#等价物。

Paul Brownjohn < PA ************* @ skynet.be>在消息中写道

news:40 ********************* @ news.skynet.be ...
Unfortunately, no I don''t believe there is. In the old days of VB, with
could provide significant performance enhancements every time you cut out a
''.'' which other than readability, was it''s primary allure. However, from
what I''ve been told, that''s no longer the case. Anyway, I agree it''s a nice
construct, but I don''t believe there''s a C# equivalent.
"Paul Brownjohn" <pa*************@skynet.be> wrote in message
news:40*********************@news.skynet.be...
你好

我是这个小组和C#编程的新手,他们花了大约15年左右的时间写C和VB。

你会原谅我希望如果我问的是完全显而易见但是这是一个我无法在文档中找到答案的问题:

在C#中是否有与With Me相同的问题。 VB中的语法;特别是
一些下载的方法,列举
a形式的可用对象,而不是记住它们或不得不去看看那里有什么?

谢谢

Paul BJ
Hello

I am new both to this group and to C# programming having spent the last 15
years or so writing C and VB.

You will forgive I hope if I am asking the totally obvious but it is a
question that I cannot find an answer to in the doc:

Is there an equivalent in C# to the "With Me" syntax in VB; specifically
some means of getting a down-down that enumerates the objects available on a form instead of having to remember them or having to go look what''s there?

Thanks

Paul BJ



不,没有C#对应物。而且,根据C#dev博客的说法,在可预见的未来,它不是

的计划。

等价代码With

OriginalObjectRef.Property1.Property2.Indexer [5]"是创建一个临时的

参考:

MyClassType ref = OriginalObjectRef.Property1.Property2.Indexer [5];

ref .Prop1 = 100;

ref.Prop2 =" some text";

ref.Method1();


那个让你不必每次都输入整个成员链,

,基本上是VB在后台编写的内容。


如果您只是担心是快速下拉智能感知,只需键入

这个。

是的,它不像使用With那么方便,但它是'你有什么。


-Rob Teixeira [MVP]


" William Ryan" <做******** @ nospam.comcast.net>在消息中写道

news:O
No, there is no C# counterpart. And, according to C# dev blogs, it''s not in
the plan for the foreseeable future either.
The equivalent code to "With
OriginalObjectRef.Property1.Property2.Indexer[5]" is to create a temp
reference:

MyClassType ref = OriginalObjectRef.Property1.Property2.Indexer[5];
ref.Prop1 = 100;
ref.Prop2 = "some text";
ref.Method1();

That keeps you from having to type the entire chain of members every time,
and is basically what VB comiles in the background.

If all you are worried about is the quick drop-down intellisense, just type
"this."
Yes, it''s not as convenient as using With, but it''s what you have.

-Rob Teixeira [MVP]

"William Ryan" <do********@nospam.comcast.net> wrote in message
news:O


************** @ TK2MSFTNGP11.phx.gbl ...
**************@TK2MSFTNGP11.phx.gbl...
不幸的是,不,我不相信有。在VB的旧时代,每当你削减
a''时,
可以提供显着的性能提升。''除了可读性之外,它是主要的吸引力。然而,从我被告知的情况来看,情况已经不再如此。无论如何,我同意它是一个
漂亮的构造,但我不相信有一个C#等价物。
Paul Brownjohn < PA ************* @ skynet.be>在消息中写道
新闻:40 ********************* @ news.skynet.be ...
Unfortunately, no I don''t believe there is. In the old days of VB, with
could provide significant performance enhancements every time you cut out a ''.'' which other than readability, was it''s primary allure. However, from
what I''ve been told, that''s no longer the case. Anyway, I agree it''s a nice construct, but I don''t believe there''s a C# equivalent.
"Paul Brownjohn" <pa*************@skynet.be> wrote in message
news:40*********************@news.skynet.be...
Hello

对于这个小组和C#编程来说,我已经花了15年左右的时间用C和VB写了最后的


你会原谅我希望如果我我问的是完全显而易见但是这是一个我无法在文档中找到答案的问题:

在C#中是否有与With Me相同的问题。 VB中的语法;特别是
某种方法可以在
Hello

I am new both to this group and to C# programming having spent the last 15 years or so writing C and VB.

You will forgive I hope if I am asking the totally obvious but it is a
question that I cannot find an answer to in the doc:

Is there an equivalent in C# to the "With Me" syntax in VB; specifically
some means of getting a down-down that enumerates the objects available on
一个
表单中列出可用的对象
,而不必记住它们或必须去看看什么'
form instead of having to remember them or having to go look what''s



那里?
谢谢

Paul BJ


there?
Thanks

Paul BJ



这篇关于&QUOT与......; C#中的等价物的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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