第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

在 C# [AttributeUsage(AttributeTargets.Parameter)]

在 C# [AttributeUsage(AttributeTargets.Parameter)]

C#
守著一只汪 2022-06-19 16:29:09
在創(chuàng)建“AttributeTargets.Parameter”構(gòu)造函數(shù)的自定義屬性時(shí)不會調(diào)用。我想在Test Class下使用Fn函數(shù)的參數(shù)值。我使用了 .net 核心和 .net 標(biāo)準(zhǔn)。class Program{    public static void Main()    {        var test = new Test();        test.Fn("Hello");        Console.WriteLine("end");        Console.Read();    }}public class Test{    public void Fn([Parameter] string parm)    {        Console.WriteLine(parm);    }}[AttributeUsage(AttributeTargets.Parameter)]public class ParameterAttribute : Attribute{    public ParameterAttribute()    {        Console.WriteLine("In Parameter Attribute");    }}
查看完整描述

1 回答

?
大話西游666

TA貢獻(xiàn)1817條經(jīng)驗(yàn) 獲得超14個贊

據(jù)我所知,屬性構(gòu)造函數(shù)僅在您開始檢查類型時(shí)執(zhí)行,而不是在創(chuàng)建該類型的實(shí)例或執(zhí)行方法時(shí)(在您的情況下)。

您可以查看此答案,了解使用自定義Attributes時(shí)執(zhí)行順序的詳細(xì)示例。

希望能幫助到你!


查看完整回答
反對 回復(fù) 2022-06-19
  • 1 回答
  • 0 關(guān)注
  • 268 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號