• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Namespace类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Namespace的典型用法代码示例。如果您正苦于以下问题:C# Namespace类的具体用法?C# Namespace怎么用?C# Namespace使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Namespace类属于命名空间,在下文中一共展示了Namespace类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Connect

        public Service Connect(Namespace ns)
        {
            var service = new Service(Scheme.Https, this.command.Host, this.command.Port, ns);
            service.LoginAsync(this.command.Username, this.command.Password).Wait();

            return service;
        }
开发者ID:paulcbetts,项目名称:splunk-sdk-csharp-pcl,代码行数:7,代码来源:TestHelper.cs


示例2: Emit

        // Generates a codedom namespace and attaches it to the compile unit (the root of the tree)
        public static void Emit(CodeCompileUnit codeCompileUnit, Namespace ns)
        {
            // Create the codedom namespace expression
            var codeNamespace = new CodeNamespace();

            // Assign the namespace name.
            codeNamespace.Name = ns.GetFullName();

            // Attach it to the root of the codedom tree.
            codeCompileUnit.Namespaces.Add(codeNamespace);

            // Create and attach the children of the namespace: classes, delegates, other namespaces, etc.
            foreach (var e in ns.ChildExpressions)
            {
                if (e is Namespace)
                    Emit(codeCompileUnit, (Namespace)e);
                if (e is Class)
                    ClassEmitter.Emit(codeNamespace, (Class)e);
                if (e is Import)
                {
                    var i = e as Import;
                    if (i.IsType) // Are we importing a class, enum, interface, struct, module?
                        codeNamespace.Imports.Add(new CodeNamespaceImport((e as Import).GetNamespace()));
                    else
                        codeNamespace.Imports.Add(new CodeNamespaceImport((e as Import).Name));
                }
                if (e is Pie.Expressions.Enum)
                    EnumEmitter.Emit(codeNamespace, e as Pie.Expressions.Enum);
                if (e is DelegateDeclaration)
                    DelegateEmitter.Emit(codeNamespace, e as DelegateDeclaration);
                if (e is Interface)
                    InterfaceEmitter.Emit(codeNamespace, e as Interface);
            }
        }
开发者ID:maleficus1234,项目名称:Pie,代码行数:35,代码来源:NamespaceEmitter.cs


示例3: ConstantInfo

 public ConstantInfo(object value, ProjectState projectState)
     : base((BuiltinClassInfo)projectState.GetNamespaceFromObjects(DynamicHelpers.GetPythonType(value)))
 {
     _value = value;
     _type = DynamicHelpers.GetPythonType(value);
     _builtinInfo = ((BuiltinClassInfo)projectState.GetNamespaceFromObjects(_type)).Instance;
 }
开发者ID:TerabyteX,项目名称:main,代码行数:7,代码来源:ConstantInfo.cs


示例4: CreateServiceAndLogin

 public Service CreateServiceAndLogin(Namespace ns = null)
 {
     var service = new Service(Config.Scheme, Config.Host, Config.Port, ns);
     var task = service.LogOnAsync(Config.Username, Config.Password);
     task.Wait();
     return service;
 }
开发者ID:scriptcs-contrib,项目名称:scriptcs-splunk,代码行数:7,代码来源:SplunkPack.cs


示例5: GenerateSymbols

        private static void GenerateSymbols(Namespace n, StringBuilder sb, string indent2)
        {
            foreach (Symbol s in n.Symbols)
            {
                if (s.Section <= 0) { continue; }

                string name = s.Demangled;
                if (s.Namespace.Length > 0)
                {
                    string namespacetext = string.Join("::", s.Namespace) + "::";
                    name = name.Replace(namespacetext, "");
                }
                name = name.Replace("__thiscall ", "");
                name = name.Replace("__cdecl ", "");

                // C functions
                if (s.Demangled == s.Name && s.DataType == IMAGE_SYM_DTYPE.IMAGE_SYM_DTYPE_FUNCTION)
                {
                    name = name + "()";
                }

                sb.Append(indent2);
                sb.AppendFormat("{0};\n", name);
            }
        }
开发者ID:BlazingHeart,项目名称:SymbolExplorer,代码行数:25,代码来源:HeaderGeneratorViewModel.cs


示例6: GenerateComponent

        public Dictionary<string, string> GenerateComponent(Namespace ns, List<Wire> wires, List<string> modules)
        {
            Dictionary<string, string> properties = new Dictionary<string, string>();
            foreach (Component component in ns.Declarations.OfType<Component>())
            {
                modules.Add(component.Name);
                ComponentType cType = ComponentType.IMPLEMENTATION;

                Dictionary<Reference, Component> dependencyMap = this.dependencyDiscoverer.GetherDependencyMap(ns, wires, component);

                List<string> dependencies = this.dependencyDiscoverer.GetherDependencies(dependencyMap);

                bool directDataAccess = this.dataAccessFinder.HasAnyDirectDataAccess(ns, wires, component);

                if (component.Services.Any())
                {
                    this.GenerateServiceImplementations(ns, modules, wires, component, dependencies, dependencyMap);
                }
                else
                {
                    if (component.Implementation != null && component.Implementation.Name.Equals("JSF"))
                    {
                        cType = ComponentType.WEB;
                        this.jSFGenerator.GenerateWebTier(ns, component, directDataAccess);
                    }
                    if (component is Composite)
                    {
                        string facadeDir = this.directoryHandler.createJavaDirectory(ns, component.Name, generatorUtil.Properties.serviceFacadePackage);
                        string facadeFile = Path.Combine(facadeDir, component.Name + "Facade.java");
                        using (StreamWriter writer = new StreamWriter(facadeFile))
                        {
                            writer.WriteLine(this.springClassGen.GenerateComponent(component));
                        }
                    }
                }
                BindingTypeHolder clientFor = new BindingTypeHolder();
                if (component.References.Any())
                {
                    clientFor = this.GenerateReferenceAccessors(ns, component, directDataAccess, dependencyMap, properties);
                }

                // generate pom.xml and spring-config.xml of Business Logic module
                this.directoryHandler.createJavaDirectory(ns, component.Name, "");
                string fileName = Path.Combine(ns.Name + "-" + component.Name, "pom.xml");
                using (StreamWriter writer = new StreamWriter(fileName))
                {
                    string s = this.springConfigGen.GenerateComponentPom(ns, component, dependencies,
                        clientFor.HasRestBinding, clientFor.HasWebServiceBinding, clientFor.HasWebSocketBinding, cType);
                    writer.WriteLine(s);
                }

                string javaDir = this.directoryHandler.createJavaDirectory(ns, component.Name, "", false);
                fileName = Path.Combine(javaDir, "spring-config.xml");
                using (StreamWriter writer = new StreamWriter(fileName))
                {
                    writer.WriteLine(this.springConfigGen.GenerateComponentSpringConfig(ns));
                }
            }
            return properties;
        }
开发者ID:Bubesz,项目名称:soal-cs,代码行数:60,代码来源:ComponentGenerator.cs


示例7: GetherDependencyMap

 public Dictionary<Reference, Component> GetherDependencyMap(Namespace ns, List<Wire> wires, Component component)
 {
     Dictionary<Reference, Component> dependencies = new Dictionary<Reference, Component>();
     foreach (Reference reference in component.References)
     {
         bool referenceStatisfied = false;
         foreach (Wire wire in wires)
         {
             if (wire.Source.Equals(reference))
             {
                 Component comp = wire.Target.Component;
                 Service target = wire.Target as Service;
                 if (target != null)
                 {
                     referenceStatisfied = true;
                     PutDependecy(dependencies, reference, target, comp);
                 }
             }
         }
         if (!referenceStatisfied)
         {
             foreach (Component comp in ns.Declarations.OfType<Component>())
             {
                 foreach (Service serv in comp.Services)
                 {
                     if (serv.Interface.Equals(reference.Interface))
                     {
                         PutDependecy(dependencies, reference, serv, comp);
                     }
                 }
             }
         }
     }
     return dependencies;
 }
开发者ID:Bubesz,项目名称:soal-cs,代码行数:35,代码来源:DependencyDiscoverer.cs


示例8: Process

        public void Process(Namespace @namespace, bool filterNamespaces = false)
        {
            TranslationUnit = @namespace.TranslationUnit;

            var collector = new RecordCollector(TranslationUnit);
            @namespace.Visit(collector);

            foreach (var record in collector.Declarations)
            {
                if (record.Value is Namespace)
                    continue;

                if (record.Value.IsDependent)
                    continue;

                if (filterNamespaces)
                {
                    var declNamespace = GetEffectiveNamespace(record.Value);

                    var isSameNamespace = declNamespace == @namespace;
                    if (declNamespace != null)
                        isSameNamespace |= declNamespace.QualifiedName == @namespace.QualifiedName;

                    if (!isSameNamespace)
                        continue;
                }

                record.Value.Visit(this);
                GenerateInclude(record);
            }
        }
开发者ID:tritao,项目名称:CppSharp,代码行数:31,代码来源:CLITypeReferences.cs


示例9: CheckDirectDataAccess

        private bool CheckDirectDataAccess(Namespace ns, List<Wire> wires, string dataModule, Reference reference, Service serv)
        {
            Component comp = serv.Component;
            bool hasDirectDataAccess = false;
            List<Binding> bindings = new List<Binding>();
            if (serv.Binding != null)
                bindings.Add(serv.Binding);
            if (reference.Binding != null)
                bindings.Add(reference.Binding);
            BindingTypeHolder binding = bindingGenerator.CheckForBindings(bindings);

            if (!binding.hasAnyBinding())
            {
                // direct access
                if (comp.Name == dataModule || dataModule == ANY && serv.Interface is Database)
                {
                    hasDirectDataAccess = true;
                }
                else
                {
                    // need to check
                    hasDirectDataAccess = HasDirectDataAccess(ns, wires, comp, dataModule);
                }
            }

            return hasDirectDataAccess;
        }
开发者ID:Bubesz,项目名称:soal-cs,代码行数:27,代码来源:DataAccessFinder.cs


示例10: Parse

        public static IExpression Parse(ref string input, Namespace ns)
        {
            var orgInput = input;

            var literal = Literal.Parse(ref input);
            if (literal != null)
                return literal;

            input = orgInput;
            var method = MethodCall.Parse(ref input, ns);
            if (method != null)
                return method;

            input = orgInput;
            var assignment = Assignment.Parse(ref input, ns);
            if (assignment != null)
            {
                assignment.ExprMode = true;
                return assignment;
            }

            input = orgInput;
            var variable = Variable.Parse(ref input, ns);
            if (variable != null)
                return variable;

            input = orgInput;
            return null;
        }
开发者ID:noahmorrison,项目名称:swish,代码行数:29,代码来源:IExpression.cs


示例11: TestClassFullName

        public void TestClassFullName()
        {
            Namespace n = new Namespace(null, null);
            n.Name = "foo";

            Class c = new Class(null, null);
            c.UnqualifiedName = "bar";
            Console.WriteLine(c.GetQualifiedName());
            Assert.AreEqual("foo", n.Name, "namespace name1");
            Assert.AreEqual("foo", n.GetFullName(), "namespace full name1");
            Assert.AreEqual("bar", c.UnqualifiedName, "class name1");
            Assert.AreEqual("bar", c.GetQualifiedName(), "class full name1");

            c.ParentExpression = n;
            Assert.AreEqual("foo", n.Name, "namespace name2");
            Assert.AreEqual("foo", n.GetFullName(), "namespace full name2");
            Assert.AreEqual("bar", c.UnqualifiedName, "class name2");
            Assert.AreEqual("foo.bar", c.GetQualifiedName(), "class full name2");

            c.ParentExpression = new Expression(null, null);
            Assert.AreEqual("foo", n.Name, "namespace name3");
            Assert.AreEqual("foo", n.GetFullName(), "namespace full name3");
            Assert.AreEqual("bar", c.UnqualifiedName, "class name3");
            Assert.AreEqual("bar", c.GetQualifiedName(), "class full name3");
        }
开发者ID:maleficus1234,项目名称:Pie,代码行数:25,代码来源:CoverageTests.cs


示例12: Parse

        public static Assignment Parse(ref string input, Namespace ns)
        {
            var orgInput = input;

            var ident = Identifier.Parse(ref input);
            if (ident == null)
                return null;

            Whitespace.Parse(ref input);

            if (input[0] != '=')
                return null;
            input = input.Substring(1);

            Whitespace.Parse(ref input);

            var expr = Expression.Parse(ref input, ns);

            if (ident.Value.Contains("."))
            {
                input = orgInput;
                return null;
            }

            var id = ns.GetScope().Add(ident.Value, expr.ReturnType);
            return new Assignment(ident, expr, id);
        }
开发者ID:noahmorrison,项目名称:swish,代码行数:27,代码来源:Assignment.cs


示例13: SortDeclarations

        private static void SortDeclarations(Namespace @namespace)
        {
            @namespace.Declarations = @namespace.Declarations.OrderBy(
                declaration => declaration.DefinitionOrder).ToList();

            foreach (var childNamespace in @namespace.Namespaces)
                SortDeclarations(childNamespace);
        }
开发者ID:daxiazh,项目名称:CppSharp,代码行数:8,代码来源:SortDeclarationsPass.cs


示例14: SortDeclarations

        private static void SortDeclarations(Namespace @namespace)
        {
            @namespace.Classes.Sort((c, c1) =>
                                    (int)(c.DefinitionOrder - c1.DefinitionOrder));

            foreach (var childNamespace in @namespace.Namespaces)
                SortDeclarations(childNamespace);
        }
开发者ID:jijamw,项目名称:CppSharp,代码行数:8,代码来源:SortDeclarationsPass.cs


示例15: BuildNamespace

        // Build a namespace expression
        public static void BuildNamespace(IronyParser parser, Root root, Expression parentExpression, ParseTreeNode currentNode)
        {
            Namespace n = new Namespace(parentExpression, currentNode.FindToken().Convert());
            n.Name = currentNode.ChildNodes[1].FindTokenAndGetText();
            parentExpression.ChildExpressions.Add(n);

            parser.ConsumeParseTree(root, n, currentNode.ChildNodes[2]);
        }
开发者ID:maleficus1234,项目名称:Pie,代码行数:9,代码来源:NamespaceBuilder.cs


示例16: Parse

        public static Variable Parse(ref string input, Namespace ns)
        {
            var ident = Identifier.Parse(ref input);
            if (ident == null)
                return null;

            return ns.GetScope().Get(ident.Value);
        }
开发者ID:noahmorrison,项目名称:swish,代码行数:8,代码来源:Variable.cs


示例17: GetNamespace

	static string GetNamespace (Namespace ns)
	{
		switch (ns) {
		case Namespace.System_Windows_Media: return "System.Windows.Media";
		case Namespace.System_Windows_Media_Animation: return "System.Windows.Media.Animation";
		default: throw new Exception ();
		}
	}
开发者ID:alesliehughes,项目名称:olive,代码行数:8,代码来源:gen-collections.cs


示例18: GetLatestResults

 public static Results GetLatestResults(String ipHost, Namespace nameSpace)
 {
     if (!latest_results.ContainsKey(nameSpace))
         latest_results[nameSpace] = new Dictionary<String, ResultsCounter>();
     if (!latest_results[nameSpace].ContainsKey(ipHost))
         latest_results[nameSpace].Add(ipHost, new ResultsCounter());
     return latest_results[nameSpace][ipHost].Results;
 }
开发者ID:fronn,项目名称:win-net-mon,代码行数:8,代码来源:ResultChecker.cs


示例19: Service

        /// <summary>
        /// Initializes a new instance of the <see cref="Service"/> class.
        /// </summary>
        /// <param name="context">
        /// The context for requests by the new <see cref="Service"/>.
        /// </param>
        /// <param name="namespace">
        /// The namespace for requests by the new <see cref="Service"/>. The
        /// default value is <c>null</c> indicating that <see cref=
        /// "Namespace.Default"/> should be used.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// <see cref="context"/> is <c>null</c>.
        /// </exception>
        public Service(Context context, Namespace @namespace = null)
        {
            Contract.Requires<ArgumentNullException>(context != null, "context");

            this.context = context;
            [email protected] = @namespace ?? Namespace.Default;
            this.receiver = new Receiver(context, this.Namespace);
            this.server = new Server(context, this.Namespace);
        }
开发者ID:paulcbetts,项目名称:splunk-sdk-csharp-pcl,代码行数:23,代码来源:Service.cs


示例20: RootNamespace

 public RootNamespace(Namespace parent, string name)
     : this(
         parent,
         (parent is GlobalRootNamespace
              ? new MemberName(name)
              : new MemberName(parent.MemberName, Separators.Dot, name)))
 {
     parent.AddNamespace(this);
 }
开发者ID:robertsundstrom,项目名称:vb-lite-compiler,代码行数:9,代码来源:RootNamespace.cs



注:本文中的Namespace类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# NamespaceDeclaration类代码示例发布时间:2022-05-24
下一篇:
C# NamedTypeBuildKey类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap