通过经验学到的.Net 习语?

发布于 2024-09-29 17:31:08 字数 84 浏览 4 评论 0 原文

我是 .Net 世界的新手,我的主要语言是 C++,其中有很多习惯用法可以帮助更好地编写代码(RAII、PIMPL...)。 C# 有哪些常见的习惯用法。

I'm new to .Net world, my primary language was C++ where there are lot of idioms that help code better(RAII,PIMPL...). What are the common idioms available for c#.

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

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

发布评论

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

评论(1

停顿的约定 2024-10-06 17:31:08

我没有给出任何习语,但既然您从 C++ 迁移,这可能很有趣:

MSDN:面向 C++ 开发人员的 C#

下表包含 C# 和本机 C++(不使用 /clr)之间的重要比较。如果您是一名 C++ 程序员,这张表将使您一目了然地了解两种语言之间最重要的差异。

C++ -> C#:从 C++ 迁移到 C# 需要了解什么

C# 建立在 C++ 的语法和语义之上,允许 C 程序员利用 .NET 和公共语言运行时。虽然从 C++ 到 C# 的过渡应该是顺利的,但有一些事情需要注意,包括对 new、结构、构造函数和析构函数的更改。本文探讨了 C# 的新语言功能,例如垃圾收集、属性、foreach 循环和接口。在讨论了接口之后,我们讨论了属性、数组和基类库。本文最后探讨了异步 I/O、属性和反射、类型发现和动态调用。

锐利的新语言:C# 提供 C++ 的强大功能和 Visual Basic 的简单性

许多开发人员希望有一种像 Visual Basic 一样易于编写、阅读和维护的语言,但仍提供 C++ 的功能和灵活性。对于那些开发人员来说,新的 C# 语言就在这里。 Microsoft 构建的 C# 具有类型安全、垃圾收集、简化类型声明、版本控制和可扩展性支持以及许多其他功能,使开发解决方案更快、更容易,特别是对于 COM+ 和 Web 服务。本文将让您初步了解 C#,在不久的将来您将会听到更多关于这种语言的信息。

C++ 与.C# - 从 C++ 程序员的角度来看的清单

所以,言归正传,非常简短,这是我列出的两者之间的差异,分为三类:我更喜欢 C# 的东西,我更喜欢 C++ 的东西以及我无法弥补的东西我的想法。

C++ 10 件事学习C#的开发者应该知道

本文并未描述所有差异,甚至跳过了一些明显的差异(例如单继承与多重继承),这些差异也不一定是最重要的,这只是我一直在考虑的一组 10 个差异,以及更多如果人们觉得这些文章有用,可能会关注这些文章。

I don't give any idioms, but since you move from C++ it maybe interesting:

MSDN: C# for C++ Developers

The following table contains important comparisons between C# and native C++, which does not use /clr. If you are a C++ programmer, this table will give you the most important differences between the two languages at a glance.

C++ -> C#: What You Need to Know to Move from C++ to C#

C# builds on the syntax and semantics of C++, allowing C programmers to take advantage of .NET and the common language runtime. While the transition from C++ to C# should be a smooth one, there are a few things to watch out for including changes to new, structs, constructors, and destructors. This article explores the language features that are new to C# such as garbage collection, properties, foreach loops, and interfaces. Following a discussion of interfaces, there's a discussion of properties, arrays, and the base class libraries. The article concludes with an exploration of asynchronous I/O, attributes and reflection, type discovery, and dynamic invocation.

Sharp New Language: C# Offers the Power of C++ and Simplicity of Visual Basic

Many developers wish there was a language that was easy to write, read, and maintain like Visual Basic, but that still provided the power and flexibility of C++. For those developers, the new C# language is here. Microsoft has built C# with type-safety, garbage collection, simplified type declarations, versioning and scalability support, and lots of other features that make developing solutions faster and easier, especially for COM+ and Web Services. This article gives you a first look at C#, a language you are going to be hearing lots more about in the very near future.

C++ vs. C# - a Checklist from a C++ Programmers Point of View

And so, without any further ado and very brief, here is my list of differences between the two, sorted into three categories: things I like better in C#, things I like better in C++ and things where I could not make up my mind.

10 Things C++ Developers Learning C# Should Know

This article does not describe all the differences and even skips some obvious ones (single vs. multiple inheritance for example), nor are these necessarily the most important, it's just a set of 10 I've been thinking about, and more articles may follow if people find these useful.

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