I am a novice in silverlight. I tried to add some random files in a silverlight project. I found two types (CodeFile and Class), both having an extension .cs.

Can anyone please tell me the difference between these two or when to use which of them?

有帮助吗?

解决方案

Both the code file and Class file are having the same extension but when you actually add it to the solution

class file comes with some autogenerated code like this

using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace defaultproject
{
    public class Class1
    {

    }
}

code file comes with no code, just empty file and you need to add what you want

just try to add both types of the file in your project you will get the difference easily...

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top