English 中文(简体)
C# 语言理论问题
原标题:C# language theory question
  • 时间:2010-01-02 09:06:03
  •  标签:
  • c#

鉴于以下方法,在我通过旁听器具的情况下,则使用每个名字的集邮方式。 在下面的法典样本中,我改动的原样子的数值是否在主要物体一中通过,我指的是什么是诺浅的复印件? 或者,你可以发现我所发现的任何错误。

更具体地说,我所说的界线。 价值 = ....... 组合目标有一组组合,因此,在这项职能被称作后,这些组合将在主标(组合)上更新?

提前感谢。

public static void DecryptProviderValues(ref MyConfiguration configuration)
    {
        foreach (var provider in configuration.Providers)
        {
            var configItems = provider.Configurations;
            foreach (Configuration config in configItems)
            {
                if(EncryptionManager.IsEncrypted(config.value))
                {
                    config.Value = EncryptionManager.Decrypt(config.Value);

                }
            }
        }
    }
最佳回答

假设此处的所有项目均为 (不是构件),则是,但实际而言,无需要以<代码>configuration通过,作为ref;请在already上附上(按价值计算)的参考资料,并注明为re-assigning<> 此处无需<代码>ref,at all。 你的变动得到保留,并可供打电话者使用。

这样做的理由完全相同:

Configuration x = new Configuration();
Configuration y = x;
x.Value = "abc";
Console.WriteLine(y.Value); // writes "abc"

这里,由于<代码>Configuration (推定) a },只有一个标的,两个变量refer至同一标的(在简化的层次上,它们是同一物体的美化点)。

问题回答

无需通过<代码>组合,代之以ref,因为在C#中,你重新操纵提到已经存在的类别。

您将使用<代码>ref,通过参考通过<代码>int或struct/code>等值类型。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...