服务器之家:专注于服务器技术及软件下载分享
分类导航

PHP教程|ASP.NET教程|Java教程|ASP教程|编程技术|正则表达式|C/C++|IOS|C#|Swift|Android|VB|R语言|JavaScript|易语言|vb.net|

服务器之家 - 编程语言 - C# - C#中Override关键字和New关键字的用法详解

C#中Override关键字和New关键字的用法详解

2021-11-09 12:02C#教程网 C#

这篇文章主要介绍了C#中Override关键字和New关键字的用法,需要的朋友可以参考下

C# 语言经过专门设计,以便不同库中的基类与派生类之间的版本控制可以不断向前发展,同时保持向后兼容。这具有多方面的意义。例如,这意味着在基类中引入与派生类中的某个成员具有相同名称的新成员在 C# 中是完全支持的,不会导致意外行为。它还意味着类必须显式声明某方法是要重写一个继承方法,还是一个隐藏具有类似名称的继承方法的新方法。
在 C# 中,派生类可以包含与基类方法同名的方法。
基类方法必须定义为 virtual。

  • 如果派生类中的方法前面没有 new 或 override 关键字,则编译器将发出警告,该方法将有如存在 new 关键字一样执行操作。
  • 如果派生类中的方法前面带有 new 关键字,则该方法被定义为独立于基类中的方法。
  • 如果派生类中的方法前面带有 override 关键字,则派生类的对象将调用该方法,而不是调用基类方法。

可以从派生类中使用 base 关键字调用基类方法。

override、virtual 和 new 关键字还可以用于属性、索引器和事件中。
默认情况下,C# 方法为非虚方法。如果某个方法被声明为虚方法,则继承该方法的任何类都可以实现它自己的版本。若要使方法成为虚方法,必须在基类的方法声明中使用 virtual 修饰符。然后,派生类可以使用 override 关键字重写基虚方法,或使用 new 关键字隐藏基类中的虚方法。如果 override 关键字和 new 关键字均未指定,编译器将发出警告,并且派生类中的方法将隐藏基类中的方法。
为了在实践中演示上述情况,我们暂时假定公司 A 创建了一个名为 GraphicsClass 的类,您的程序将使用此类。 GraphicsClass 如下所示:

?
1
2
3
4
5
class GraphicsClass
{
  public virtual void DrawLine() { }
  public virtual void DrawPoint() { }
}

您的公司使用此类,并且您在添加新方法时将其用来派生自己的类:

?
1
2
3
4
class YourDerivedGraphicsClass : GraphicsClass
{
  public void DrawRectangle() { }
}

您的应用程序运行正常,直到公司 A 发布了 GraphicsClass 的新版本,类似于下面的代码:

?
1
2
3
4
5
6
class GraphicsClass
{
  public virtual void DrawLine() { }
  public virtual void DrawPoint() { }
  public virtual void DrawRectangle() { }
}

现在,GraphicsClass 的新版本中包含一个名为 DrawRectangle 的方法。开始时,没有出现任何问题。新版本仍然与旧版本保持二进制兼容。已经部署的任何软件都将继续正常工作,即使新类已安装到这些软件所在的计算机系统上。在您的派生类中,对方法 DrawRectangle 的任何现有调用将继续引用您的版本。
但是,一旦您使用 GraphicsClass 的新版本重新编译应用程序,就会收到来自编译器的警告 CS0108。此警告提示您必须考虑希望 DrawRectangle 方法在应用程序中的工作方式。
如果您希望自己的方法重写新的基类方法,请使用 override 关键字:

?
1
2
3
4
class YourDerivedGraphicsClass : GraphicsClass
{
  public override void DrawRectangle() { }
}

override 关键字可确保派生自 YourDerivedGraphicsClass 的任何对象都将使用 DrawRectangle 的派生类版本。派生自 YourDerivedGraphicsClass 的对象仍可以使用基关键字访问 DrawRectangle 的基类版本:

?
1
base.DrawRectangle();

如果您不希望自己的方法重写新的基类方法,则需要注意以下事项。为了避免这两个方法之间发生混淆,可以重命名您的方法。这可能很耗费时间且容易出错,而且在某些情况下并不可行。但是,如果您的项目相对较小,则可以使用 Visual Studio 的重构选项来重命名方法。

或者,也可以通过在派生类定义中使用关键字 new 来防止出现该警告:

?
1
2
3
4
class YourDerivedGraphicsClass : GraphicsClass
{
  public new void DrawRectangle() { }
}

使用 new 关键字可告诉编译器您的定义将隐藏基类中包含的定义。这是默认行为。
重写和方法选择
当在类中指定方法时,如果有多个方法与调用兼容(例如,存在两种同名的方法,并且其参数与传递的参数兼容),则 C# 编译器将选择最佳方法进行调用。下面的方法将是兼容的:

?
1
2
3
4
5
public class Derived : Base
{
  public override void DoWork(int param) { }
  public void DoWork(double param) { }
}

在 Derived 的一个实例中调用 DoWork 时,C# 编译器将首先尝试使该调用与最初在 Derived 上声明的 DoWork 版本兼容。重写方法不被视为是在类上进行声明的,而是在基类上声明的方法的新实现。仅当 C# 编译器无法将方法调用与 Derived 上的原始方法匹配时,它才尝试将该调用与具有相同名称和兼容参数的重写方法匹配。例如:

?
1
2
3
int val = 5;
Derived d = new Derived();
d.DoWork(val); // Calls DoWork(double).

由于变量 val 可以隐式转换为 double 类型,因此 C# 编译器将调用 DoWork(double),而不是 DoWork(int)。有两种方法可以避免此情况。首先,避免将新方法声明为与虚方法同名。其次,可以通过将 Derived 的实例强制转换为 Base 来使 C# 编译器搜索基类方法列表,从而使其调用虚方法。由于是虚方法,因此将调用 Derived 上的 DoWork(int) 的实现。例如:

?
1
((Base)d).DoWork(val); // Calls DoWork(int) on Derived.

何时使用 Override 和 New 关键字
在 C# 中,派生类中方法的名称可与基类中方法的名称相同。可通过使用 new 和 override 关键字指定方法互动的方式。 override 修饰符 extends 基类方法,且 new 修饰符将其“隐藏”起来。这种区别在本主题中的示例显示出来。
在控制台应用程序中,声明下面的 BaseClass 和 DerivedClass 两个类. DerivedClass 继承自 BaseClass。

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class BaseClass
{
  public void Method1()
  {
    Console.WriteLine("Base - Method1");
  }
}
 
class DerivedClass : BaseClass
{
  public void Method2()
  {
    Console.WriteLine("Derived - Method2");
  }
}

在 Main 方法中,声明变量 bc、dc 和 bcdc。

  • bc 的类型为 BaseClass,并且其值的类型为 BaseClass。
  • dc的类型为 DerivedClass,并且其值的类型为 DerivedClass。
  • bcdc的类型为 BaseClass,并且其值的类型为 DerivedClass。这是要密切注意的变量。

由于 bc 和 bcdc 具有类型 BaseClass,因此,除非您使用强制转换,否则它们只会直接访问 Method1。变量 dc 可以访问 Method1 和 Method2。下面的代码演示这些关系。

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class Program
{
  static void Main(string[] args)
  {
    BaseClass bc = new BaseClass();
    DerivedClass dc = new DerivedClass();
    BaseClass bcdc = new DerivedClass();
 
    bc.Method1();
    dc.Method1();
    dc.Method2();
    bcdc.Method1();
  }
  // Output:
  // Base - Method1
  // Base - Method1
  // Derived - Method2
  // Base - Method1
}

接下来,将以下 Method2 方法添加到 BaseClass。此方法的签名与 DerivedClass 中 Method2 方法的签名相匹配。

?
1
2
3
4
public void Method2()
{
  Console.WriteLine("Base - Method2");
}

由于 BaseClass 现在有 Method2 方法,因此可以为 BaseClass 变量 bc 和 bcdc 添加第二个调用语句,如下面的代码所示。

?
1
2
3
4
5
6
bc.Method1();
bc.Method2();
dc.Method1();
dc.Method2();
bcdc.Method1();
bcdc.Method2();


当生成项目时,您将看到在 BaseClass 中添加 Method2 方法将引发警告。警告提示,DerivedClass 中的 Method2 方法将 Method2 方法隐藏在 BaseClass 中。如果要获得该结果,则建议您使用 Method2 定义中的 new 关键字。或者,可以重命名 Method2 方法之一来解决警告,但这始终不实用。
在添加 new 之前,运行该程序以查看其他调用语句生成的输出。显示以下结果。

输出:

?
1
2
3
4
5
6
Base - Method1
Base - Method2
Base - Method1
Derived - Method2
Base - Method1
Base - Method2

new 关键字可以保留生成输出的关系,但它将取消警告。具有 BaseClass 类型的变量继续访问 BaseClass 成员,具有 DerivedClass 类型的变量首先继续访问 DerivedClass 中的成员,然后再考虑从 BaseClass 继承的成员.
要禁止显示警告,请向 DerivedClass 中的 Method2 定义添加 new 修饰符,如下面的示例所示:可在 public 前后添加修饰符。

?
1
2
3
4
public new void Method2()
{
  Console.WriteLine("Derived - Method2");
}

再次运行该程序以确认没有更改输出。还确认警告不再出现。通过使用 new,您断言您了解它修改的成员将隐藏从基类继承的成员。关于通过继承隐藏名称的更多信息,请参见 new 修饰符(C# 参考)。
要将此行为与使用 override 的效果进行对比,请将以下方法添加到 DerivedClass。可在 public 的前面或后面添加 override 修饰符。

?
1
2
3
4
public override void Method1()
{
  Console.WriteLine("Derived - Method1");
}

将 virtual 修饰符添加到 BaseClass 中的 Method1 的定义。可在 public 的前面或后面添加 virtual 修饰符。

?
1
2
3
4
public virtual void Method1()
{
  Console.WriteLine("Base - Method1");
}

再次运行项目。尤其请注意下面输出的最后两行。

输出:

?
1
2
3
4
5
6
Base - Method1
Base - Method2
Derived - Method1
Derived - Method2
Derived - Method1
Base - Method2

使用 override 修饰符使 bcdc 能够访问 DerivedClass 中定义的 Method1 方法。通常,这是继承层次结构中所需的行为。让具有从派生类创建的值的对象使用派生类中定义的方法。通过使用 override 扩展基类方法可实现该行为。
下面的代码包括完整的示例。

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
using System;
using System.Text;
 
namespace OverrideAndNew
{
  class Program
  {
    static void Main(string[] args)
    {
      BaseClass bc = new BaseClass();
      DerivedClass dc = new DerivedClass();
      BaseClass bcdc = new DerivedClass();
 
      // The following two calls do what you would expect. They call
      // the methods that are defined in BaseClass.
      bc.Method1();
      bc.Method2();
      // Output:
      // Base - Method1
      // Base - Method2
 
 
      // The following two calls do what you would expect. They call
      // the methods that are defined in DerivedClass.
      dc.Method1();
      dc.Method2();
      // Output:
      // Derived - Method1
      // Derived - Method2
 
 
      // The following two calls produce different results, depending
      // on whether override (Method1) or new (Method2) is used.
      bcdc.Method1();
      bcdc.Method2();
      // Output:
      // Derived - Method1
      // Base - Method2
    }
  }
 
  class BaseClass
  {
    public virtual void Method1()
    {
      Console.WriteLine("Base - Method1");
    }
 
    public virtual void Method2()
    {
      Console.WriteLine("Base - Method2");
    }
  }
 
  class DerivedClass : BaseClass
  {
    public override void Method1()
    {
      Console.WriteLine("Derived - Method1");
    }
 
    public new void Method2()
    {
      Console.WriteLine("Derived - Method2");
    }
  }
}


以下示例显示了不同上下文中的类似行为。该示例定义了三个类:一个名为 Car 的基类,和两个由其派生的 ConvertibleCar 和 Minivan。基类中包含 DescribeCar 方法。该方法给出了对一辆车的基本描述,然后调用 ShowDetails 来提供其他的信息。这三个类中的每一个类都定义了 ShowDetails 方法。 new 修饰符用于定义 ConvertibleCar 类中的 ShowDetails。 override 修饰符用于定义 Minivan 类中的 ShowDetails。

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Define the base class, Car. The class defines two methods,
// DescribeCar and ShowDetails. DescribeCar calls ShowDetails, and each derived
// class also defines a ShowDetails method. The example tests which version of
// ShowDetails is selected, the base class method or the derived class method.
class Car
{
  public void DescribeCar()
  {
    System.Console.WriteLine("Four wheels and an engine.");
    ShowDetails();
  }
 
  public virtual void ShowDetails()
  {
    System.Console.WriteLine("Standard transportation.");
  }
}
 
// Define the derived classes.
 
// Class ConvertibleCar uses the new modifier to acknowledge that ShowDetails
// hides the base class method.
class ConvertibleCar : Car
{
  public new void ShowDetails()
  {
    System.Console.WriteLine("A roof that opens up.");
  }
}
 
// Class Minivan uses the override modifier to specify that ShowDetails
// extends the base class method.
class Minivan : Car
{
  public override void ShowDetails()
  {
    System.Console.WriteLine("Carries seven people.");
  }
}

该示例测试被调用的 ShowDetails 版本。以下方法,TestCars1 为每个类提供了一个实例,并在每个实例上调用 DescribeCar。

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
public static void TestCars1()
{
  System.Console.WriteLine("\nTestCars1");
  System.Console.WriteLine("----------");
 
  Car car1 = new Car();
  car1.DescribeCar();
  System.Console.WriteLine("----------");
 
 
  // Notice the output from this test case. The new modifier is
  // used in the definition of ShowDetails in the ConvertibleCar
  // class.
 
  ConvertibleCar car2 = new ConvertibleCar();
  car2.DescribeCar();
  System.Console.WriteLine("----------");
 
  Minivan car3 = new Minivan();
  car3.DescribeCar();
  System.Console.WriteLine("----------");
}


TestCars1 生成以下输出:尤其请注意 car2 的结果,该结果可能不是您所需的内容。对象的类型是 ConvertibleCar,但 DescribeCar 不会访问 ConvertibleCar 中定义的 ShowDetails 版本,因为方法已声明包含 new 修饰符,而不是 override 修饰符。因此,ConvertibleCar 对象显示与 Car 对象相同的说明。比较 car3 的结果,它是一个 Minivan 对象。在这种情况下,在 Minivan 类中声明的 ShowDetails 方法重写 Car 类中声明的 ShowDetails 方法,显示的说明描述微型面包车。

?
1
2
3
4
5
6
7
8
9
10
11
// TestCars1
// ----------
// Four wheels and an engine.
// Standard transportation.
// ----------
// Four wheels and an engine.
// Standard transportation.
// ----------
// Four wheels and an engine.
// Carries seven people.
// ----------

TestCars2 创建 Car 类型的对象列表。对象的值由 Car、ConvertibleCar 和 Minivan 类实例化而来。 DescribeCar 是调用列表中的每个元素。以下代码显示了 TestCars2 的定义。

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
public static void TestCars2()
{
  System.Console.WriteLine("\nTestCars2");
  System.Console.WriteLine("----------");
 
  var cars = new List<Car> { new Car(), new ConvertibleCar(),
    new Minivan() };
 
  foreach (var car in cars)
  {
    car.DescribeCar();
    System.Console.WriteLine("----------");
  }
}

显示以下输出。请注意,此输出与由 TestCars1 显示的输出相同。 ConvertibleCar 类的 ShowDetails 方法不被调用,无论对象的类型是 ConvertibleCar,如在 TestCars1 中,还是 Car,如在 TestCars2 中。相反,car3 在两种情况下都从 Minivan 类调用 ShowDetails 方法,无论它具有类型 Minivan 还是类型 Car。

?
1
2
3
4
5
6
7
8
9
10
11
// TestCars2
// ----------
// Four wheels and an engine.
// Standard transportation.
// ----------
// Four wheels and an engine.
// Standard transportation.
// ----------
// Four wheels and an engine.
// Carries seven people.
// ----------

完成示例的方法 TestCars3 和 TestCars4。这些方法直接调用 ShowDetails,首先从宣布具有类型 ConvertibleCar 和 Minivan (TestCars3) 的对象调用,然后从具有类型 Car (TestCars4) 的对象调用。以下代码定义了这两种方法。

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
public static void TestCars3()
{
  System.Console.WriteLine("\nTestCars3");
  System.Console.WriteLine("----------");
  ConvertibleCar car2 = new ConvertibleCar();
  Minivan car3 = new Minivan();
  car2.ShowDetails();
  car3.ShowDetails();
}
 
public static void TestCars4()
{
  System.Console.WriteLine("\nTestCars4");
  System.Console.WriteLine("----------");
  Car car2 = new ConvertibleCar();
  Car car3 = new Minivan();
  car2.ShowDetails();
  car3.ShowDetails();
}

该方法产生下面的输出,它对应本主题中第一个示例的结果。

?
1
2
3
4
5
6
7
8
9
// TestCars3
// ----------
// A roof that opens up.
// Carries seven people.
 
// TestCars4
// ----------
// Standard transportation.
// Carries seven people.

以下代码显示了整个项目及其输出。

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace OverrideAndNew2
{
  class Program
  {
    static void Main(string[] args)
    {
      // Declare objects of the derived classes and test which version
      // of ShowDetails is run, base or derived.
      TestCars1();
 
      // Declare objects of the base class, instantiated with the
      // derived classes, and repeat the tests.
      TestCars2();
 
      // Declare objects of the derived classes and call ShowDetails
      // directly.
      TestCars3();
 
      // Declare objects of the base class, instantiated with the
      // derived classes, and repeat the tests.
      TestCars4();
    }
 
    public static void TestCars1()
    {
      System.Console.WriteLine("\nTestCars1");
      System.Console.WriteLine("----------");
 
      Car car1 = new Car();
      car1.DescribeCar();
      System.Console.WriteLine("----------");
 
      // Notice the output from this test case. The new modifier is
      // used in the definition of ShowDetails in the ConvertibleCar
      // class.
      ConvertibleCar car2 = new ConvertibleCar();
      car2.DescribeCar();
      System.Console.WriteLine("----------");
 
      Minivan car3 = new Minivan();
      car3.DescribeCar();
      System.Console.WriteLine("----------");
    }

输出:

?
1
2
3
4
5
6
7
8
9
10
11
TestCars1
----------
Four wheels and an engine.
Standard transportation.
----------
Four wheels and an engine.
Standard transportation.
----------
Four wheels and an engine.
Carries seven people.
----------


 

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
public static void TestCars2()
{
  System.Console.WriteLine("\nTestCars2");
  System.Console.WriteLine("----------");
 
  var cars = new List<Car> { new Car(), new ConvertibleCar(),
    new Minivan() };
 
  foreach (var car in cars)
  {
    car.DescribeCar();
    System.Console.WriteLine("----------");
  }
}

输出:

?
1
2
3
4
5
6
7
8
9
10
11
TestCars2
----------
Four wheels and an engine.
Standard transportation.
----------
Four wheels and an engine.
Standard transportation.
----------
Four wheels and an engine.
Carries seven people.
----------

 

?
1
2
3
4
5
6
7
8
9
public static void TestCars3()
{
  System.Console.WriteLine("\nTestCars3");
  System.Console.WriteLine("----------");
  ConvertibleCar car2 = new ConvertibleCar();
  Minivan car3 = new Minivan();
  car2.ShowDetails();
  car3.ShowDetails();
}

输出:       

?
1
2
3
4
TestCars3
----------
A roof that opens up.
Carries seven people.

 

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
    public static void TestCars4()
    {
      System.Console.WriteLine("\nTestCars4");
      System.Console.WriteLine("----------");
      Car car2 = new ConvertibleCar();
      Car car3 = new Minivan();
      car2.ShowDetails();
      car3.ShowDetails();
    }
    // Output:
    // TestCars4
    // ----------
    // Standard transportation.
    // Carries seven people.
  }
 
 
 
  // Define the base class, Car. The class defines two virtual methods,
  // DescribeCar and ShowDetails. DescribeCar calls ShowDetails, and each derived
  // class also defines a ShowDetails method. The example tests which version of
  // ShowDetails is used, the base class method or the derived class method.
  class Car
  {
    public virtual void DescribeCar()
    {
      System.Console.WriteLine("Four wheels and an engine.");
      ShowDetails();
    }
 
    public virtual void ShowDetails()
    {
      System.Console.WriteLine("Standard transportation.");
    }
  }
 
 
  // Define the derived classes.
 
  // Class ConvertibleCar uses the new modifier to acknowledge that ShowDetails
  // hides the base class method.
  class ConvertibleCar : Car
  {
    public new void ShowDetails()
    {
      System.Console.WriteLine("A roof that opens up.");
    }
  }
 
  // Class Minivan uses the override modifier to specify that ShowDetails
  // extends the base class method.
  class Minivan : Car
  {
    public override void ShowDetails()
    {
      System.Console.WriteLine("Carries seven people.");
    }
  }
 
}

延伸 · 阅读

精彩推荐
  • C#C#设计模式之Strategy策略模式解决007大破密码危机问题示例

    C#设计模式之Strategy策略模式解决007大破密码危机问题示例

    这篇文章主要介绍了C#设计模式之Strategy策略模式解决007大破密码危机问题,简单描述了策略模式的定义并结合加密解密算法实例分析了C#策略模式的具体使用...

    GhostRider10972022-01-21
  • C#如何使用C#将Tensorflow训练的.pb文件用在生产环境详解

    如何使用C#将Tensorflow训练的.pb文件用在生产环境详解

    这篇文章主要给大家介绍了关于如何使用C#将Tensorflow训练的.pb文件用在生产环境的相关资料,文中通过示例代码介绍的非常详细,需要的朋友可以参考借鉴...

    bbird201811792022-03-05
  • C#三十分钟快速掌握C# 6.0知识点

    三十分钟快速掌握C# 6.0知识点

    这篇文章主要介绍了C# 6.0的相关知识点,文中介绍的非常详细,通过这篇文字可以让大家在三十分钟内快速的掌握C# 6.0,需要的朋友可以参考借鉴,下面来...

    雨夜潇湘8272021-12-28
  • C#深入理解C#的数组

    深入理解C#的数组

    本篇文章主要介绍了C#的数组,数组是一种数据结构,详细的介绍了数组的声明和访问等,有兴趣的可以了解一下。...

    佳园9492021-12-10
  • C#利用C#实现网络爬虫

    利用C#实现网络爬虫

    这篇文章主要介绍了利用C#实现网络爬虫,完整的介绍了C#实现网络爬虫详细过程,感兴趣的小伙伴们可以参考一下...

    C#教程网11852021-11-16
  • C#VS2012 程序打包部署图文详解

    VS2012 程序打包部署图文详解

    VS2012虽然没有集成打包工具,但它为我们提供了下载的端口,需要我们手动安装一个插件InstallShield。网上有很多第三方的打包工具,但为什么偏要使用微软...

    张信秀7712021-12-15
  • C#SQLite在C#中的安装与操作技巧

    SQLite在C#中的安装与操作技巧

    SQLite,是一款轻型的数据库,用于本地的数据储存。其优点有很多,下面通过本文给大家介绍SQLite在C#中的安装与操作技巧,感兴趣的的朋友参考下吧...

    蓝曈魅11162022-01-20
  • C#C#微信公众号与订阅号接口开发示例代码

    C#微信公众号与订阅号接口开发示例代码

    这篇文章主要介绍了C#微信公众号与订阅号接口开发示例代码,结合实例形式简单分析了C#针对微信接口的调用与处理技巧,需要的朋友可以参考下...

    smartsmile20127762021-11-25