如何给有意义的名称为C#和VB.NET项目有异曲同工之妙相同的解决方案?异曲同工、有意义、之妙、解决方案

2023-09-04 11:25:02 作者:幸福甜蜜的,女生幸福

我有两个项目包含扩展方法。其中一个项目是用C#实现,另一种是使用VB.NET实现的,因为有一些事情,我可以在VB.NET做,我不能在C#中,我想利用我的扩展方法的功能。

我如何命名的项目来传达自己的意思,而在同一时间的差异,他们用不同的语言来实现?

有关C#的精英:

一个是VB.NET支持C#不的特点:

Doesn't C#扩展方法允许通过引用传递参数?

FYI:这不适用于引用类型的工作,这是我感兴趣的。

 公共静态无效LoadFromXml< T>(这件T目标对象,XML字符串)
{

    目标对象= _Serializer.DeserializeFromXML< T>(XML);

}
 

解决方案

嗯...刚才看到你的评论。我会建议实施大部分的扩展方法在C#中,把它的核心,然后实现额外的功能在VB.NET,并称之为扩展。

然后,已在VB.NET明确地引用核心,并从它继承。然后,用户可以使用核心组件对于大多数的任务,或扩展为附加功能。

编辑:我仍然认为你的用户会更好,如果你想出一个办法不拆分组件了,但很明显,我不知道您的所有需求/实施细节

vb.net中关于排序,查询的问题

I have two projects that contain extension methods. One project is implemented using C# and the other is implemented using VB.NET as there are some things I can do in VB.NET that I can't in C# and I want to leverage those features in my extension methods.

How can I name the projects to convey their meaning while at the same time differentiating that they are implemented in different languages?

For the C# elitists:

One of the features that VB.NET supports that C# doesn't:

Doesn't C# Extension Methods allow passing parameters by reference?

FYI: This doesn't work for reference types, which is what I'm interested in.

public static void LoadFromXml<T>(this T targetObject, string xml)
{

    targetObject = _Serializer.DeserializeFromXML<T>(xml);

}

解决方案

Ah... just saw your comment. I would recommend implementing most of your extension methods in C# and calling it "Core", then implement the extra features in VB.NET and call it "Extended".

Then, have the VB.NET explicitly reference Core and inherit from it. Users can then use the Core assembly for most of the tasks, or Extended for the additional features.

EDIT: I still think your users would be better off if you figured out a way NOT to split the assemblies, but obviously I don't know all of your requirements/implementation details.